|
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 > |
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)); }); } };
| T | the nested type whose Formatter is reused. |
| Char | the character type. |