|
microfmt
Zero-allocation C++ formatting for constrained environments
|
Drop-in replacement for a formatter<T> underlying_formatter; member used by container/wrapper formatters (reloco.hpp, tuple.hpp, map_view.hpp, filter_view.hpp, ranges.hpp, variant.hpp, ...) to format their elements/keys/values.
More...
#include <microfmt.hpp>
Classes | |
| struct | no_formatter_stub |
Public Types | |
| using | DecayedT = std::decay_t< T > |
Public Member Functions | |
| constexpr void | parse (format_parse_context &ctx) noexcept |
| void | format (const T &value, const sink &out) const noexcept |
Public Attributes | |
| std::conditional_t< has_formatter_v< DecayedT >, formatter< DecayedT >, no_formatter_stub > | underlying {} |
Drop-in replacement for a formatter<T> underlying_formatter; member used by container/wrapper formatters (reloco.hpp, tuple.hpp, map_view.hpp, filter_view.hpp, ranges.hpp, variant.hpp, ...) to format their elements/keys/values.
Exposes the same parse(format_parse_context&) / format(const T&, const sink&) const interface as formatter<T> itself, but implements the same formatter<T> -> reloco::Display<T> -> reloco::Debug<T> priority chain as format_type_thunk above, instead of requiring a formatter<T> specialization unconditionally. This lets element types that only have a reloco::Display<T>/reloco::Debug<T> (and no formatter<T>) be nested inside containers/wrappers.
Display<T>/Debug<T> take no format spec (mirroring Rust), so parse simply discards the spec on those two paths, exactly as format_type_thunk does for a top-level {} placeholder.
| using microfmt::detail::element_formatter< T >::DecayedT = std::decay_t<T> |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
| std::conditional_t<has_formatter_v<DecayedT>, formatter<DecayedT>, no_formatter_stub> microfmt::detail::element_formatter< T >::underlying {} |