C++ named requirements: BasicFormatter
From cppreference.com
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 type -
CharT, a character type -
BasicFormatter, a BasicFormatter type for typesArgandCharT -
OutputIt, a LegacyOutputIterator type -
f, a value of typeBasicFormatter -
arg, an lvalue of typeArg -
ParseContext, an alias of std::basic_format_parse_context<CharT> -
FormatContext, an alias of std::basic_format_context<OutputIt, CharT> -
parse_ctx, an lvalue of typeParseContext -
format_ctx, an lvalue of typeFormatContext
| Expression | Return type | Semantics |
|---|---|---|
| f.parse(parse_ctx) | ParseContext::iterator |
|
| f.format(arg, format_ctx) | FormatContext::iterator |
|
- ↑ This allows formatters to emit meaningful error messages.