fmt
Loading...
Searching...
No Matches
fmt::NestedFormatter< T, Char > Struct Template Referenceexport
module fmt

Public Member Functions

constexpr auto parse (ParseContext< Char > &ctx) -> const Char *
template<typename FormatContext, typename F>
auto writePadded (FormatContext &ctx, F write) const -> decltype(ctx.out())
auto nested (const T &value) const -> NestedView< T, Char >

Detailed Description

template<typename T, typename Char = char>
struct fmt::NestedFormatter< T, Char >

A Formatter base that applies width, fill and alignment to whatever a nested Formatter produces.

Derive from this and call write_padded with a callable that writes the unpadded content; the padding specifiers are consumed here and the rest of the specification is passed to the nested Formatter<T>:

struct point { double x, y; };

template <> struct fmt::Formatter<point> :

nested_formatter<double> { auto format(point p, FormatContext& ctx) const { return writePadded(ctx, [=](auto out) { return fmt::formatTo(out, "({}, {})", nested(p.x), nested(p.y)); }); } };

Template Parameters
Tthe nested type whose Formatter is reused.
Charthe character type.

The documentation for this struct was generated from the following file:
  • /home/mccakit/desktop/mccakit-fmt/fmt/src/fmt/iface/format.cppm