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 typesArgandCharTOutputIt, a LegacyOutputIterator typef, a value of type (possibly const)BasicFormatterg, a value of typeBasicFormatterarg, an lvalue of typeArgParseContext, an alias ofstd::basic_format_parse_context<CharT>FormatContext, an alias ofstd::basic_format_context<OutputIt, CharT>parse_ctx, an lvalue of typeParseContextformat_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