[formatter.requirements] (original) (raw)

28 Text processing library [text]

28.5 Formatting [format]

28.5.6 Formatter [format.formatter]

28.5.6.1 Formatter requirements [formatter.requirements]

A type F meets the BasicFormatter requirements if it meets the

requirements, and the expressions shown in Table 110 are valid and have the indicated semantics.

A type F meets the Formatter requirements if it meets the BasicFormatter requirements and the expressions shown in Table 111 are valid and have the indicated semantics.

Given character type charT, output iterator typeOut, and formatting argument type T, in Table 110 and Table 111:

pc.begin() points to the beginning of the_format-spec_ ([format.string]) of the replacement field being formatted in the format string.

If format-spec is not present or empty then eitherpc.begin() == pc.end() or*pc.begin() == '}'.

Table 110BasicFormatter requirements [tab:formatter.basic]

Parses format-spec ([format.string]) for type Tin the range [pc.begin(), pc.end()) until the first unmatched character. Throws format_error unless the whole range is parsed or the unmatched character is }. [Note 1: This allows formatters to emit meaningful error messages. — _end note_] Stores the parsed format specifiers in *this and returns an iterator past the end of the parsed range.
Formats u according to the specifiers stored in *this, writes the output to fc.out(), and returns an iterator past the end of the output range. The output shall only depend onu,fc.locale(),fc.arg(n) for any value n of type size_t, and the range [pc.begin(), pc.end()) from the last call to f.parse(pc).

Table 111Formatter requirements [tab:formatter]

Formats t according to the specifiers stored in *this, writes the output to fc.out(), and returns an iterator past the end of the output range. The output shall only depend ont,fc.locale(),fc.arg(n) for any value n of type size_t, and the range [pc.begin(), pc.end()) from the last call to f.parse(pc).
As above, but does not modify u.