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

Function format

include/fmt/ranges.h:472–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470
471 template <typename R, typename FormatContext>
472 FMT_CONSTEXPR auto format(R&& range, FormatContext& ctx) const
473 -> decltype(ctx.out()) {
474 auto out = ctx.out();
475 auto it = detail::range_begin(range);
476 auto end = detail::range_end(range);
477 if (is_debug) return write_debug_string(out, std::move(it), end);
478
479 out = detail::copy<Char>(opening_bracket_, out);
480 int i = 0;
481 for (; it != end; ++it) {
482 if (i > 0) out = detail::copy<Char>(separator_, out);
483 ctx.advance_to(out);
484 auto&& item = *it; // Need an lvalue
485 out = underlying_.format(item, ctx);
486 ++i;
487 }
488 out = detail::copy<Char>(closing_bracket_, out);
489 return out;
490 }
491};
492
493FMT_EXPORT

Callers 1

formatMethod · 0.70

Calls 6

range_beginFunction · 0.85
range_endFunction · 0.85
write_debug_stringFunction · 0.85
outMethod · 0.45
advance_toMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected