Difference between revisions of "cpp/named req/Formatter"
From cppreference.com
D41D8CD98F (Talk | contribs) (avoid use of 'model' since Formatter is not a concept) |
(Move the DR list to cpp/utility/format.) |
||
Line 35: | Line 35: | ||
|} | |} | ||
<references group="note"/> | <references group="note"/> | ||
− | |||
− | |||
− | |||
− | |||
{{langlinks|de|es|fr|it|ja|pt|ru|zh}} | {{langlinks|de|es|fr|it|ja|pt|ru|zh}} |
Revision as of 00:26, 30 June 2022
Formatter is a type that abstracts formatting operations for a given formatting argument type and character type. Specializations of std::formatter provided by the standard library are required to meet the requirements of Formatter except as noted otherwise.
A Formatter is able to format both const and non-const arguments, typically by providing a format
member function that takes a const reference.
Requirements
A type satisfies Formatter if it satisfies BasicFormatter and given
-
Arg
, a formatting argument type -
CharT
, a character type -
Formatter
, a Formatter type for typesArg
andCharT
-
OutputIt
, a LegacyOutputIterator type -
f
, a value of typeFormatter
-
arg
, an lvalue of typeArg
-
t
, a value of type convertible to (possibly const)Arg
-
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.format(t, format_ctx) | FormatContext::iterator |
|
f.format(arg, format_ctx) | FormatContext::iterator |
As above, but does not modify |