MCPcopy Create free account
hub / github.com/fmtlib/fmt / write_nonfinite

Method write_nonfinite

include/fmt/format.h:2371–2387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2369
2370template <typename Char, typename OutputIt>
2371FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan,
2372 format_specs specs, sign s) -> OutputIt {
2373 auto str =
2374 isnan ? (specs.upper() ? "NAN" : "nan") : (specs.upper() ? "INF" : "inf");
2375 constexpr size_t str_size = 3;
2376 auto size = str_size + (s != sign::none ? 1 : 0);
2377 // Replace '0'-padding with space for non-finite values.
2378 const bool is_zero_fill =
2379 specs.fill_size() == 1 && specs.fill_unit<Char>() == '0';
2380 if (is_zero_fill) specs.set_fill(' ');
2381 return write_padded<Char>(out, specs, size,
2382 [=](reserve_iterator<OutputIt> it) {
2383 if (s != sign::none)
2384 *it++ = detail::getsign<Char>(s);
2385 return copy<Char>(str, str + str_size, it);
2386 });
2387}
2388
2389// A decimal floating-point number significand * pow(10, exp).
2390struct big_decimal_fp {

Callers

nothing calls this directly

Calls 3

upperMethod · 0.80
fill_sizeMethod · 0.80
set_fillMethod · 0.80

Tested by

no test coverage detected