On this page
C++ named requirements: BasicFormatter (since C++20)
BasicFormatter is a type that abstracts formatting operations for a given formatting argument type and character type. Specializations of std::formatter
are required to meet the requirements of BasicFormatter.
A BasicFormatter is a Formatter if it is able to format both const and non-const arguments.
Requirements
A type satisfies BasicFormatter if it is semiregular, meaning it satisfies:
And, given
Arg
, a formatting argument typeCharT
, a character typeBasicFormatter
, a BasicFormatter type for typesArg
andCharT
OutputIt
, a LegacyOutputIterator typef
, a value of type (possibly const)BasicFormatter
g
, a value of typeBasicFormatter
arg
, an lvalue of typeArg
ParseContext
, an alias ofstd::basic_format_parse_context<CharT>
FormatContext
, an alias ofstd::basic_format_context<OutputIt, CharT>
parse_ctx
, an lvalue of typeParseContext
format_ctx
, an lvalue of typeFormatContext
Expression | Return type | Semantics |
---|---|---|
g.parse(parse_ctx) |
ParseContext::iterator |
|
f.format(arg, format_ctx) |
FormatContext::iterator |
|
- This allows formatters to emit meaningful error messages.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/named_req/BasicFormatter