28 Text processing library [text]

28.3 Localization library [localization]

28.3.4 Standard locale categories [locale.categories]

28.3.4.4 The numeric punctuation facet [facet.numpunct]

28.3.4.4.1 Class template numpunct [locale.numpunct]

28.3.4.4.1.1 General [locale.numpunct.general]

namespace std { template<class charT> class numpunct : public locale::facet { public: using char_type = charT; using string_type = basic_string<charT>; explicit numpunct(size_t refs = 0); char_type decimal_point() const; char_type thousands_sep() const; string grouping() const; string_type truename() const; string_type falsename() const; static locale::id id; protected: ~numpunct(); // virtual virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; virtual string_type do_truename() const; // for bool virtual string_type do_falsename() const; // for bool }; }
numpunct<> specifies numeric punctuation.
The specializations required in Table 86 ([locale.category]), namely numpunct<wchar_t> and numpunct<char>, provide classic "C" numeric formats, i.e., they contain information equivalent to that contained in the "C" locale or their wide character counterparts as if obtained by a call to widen.
The syntax for number formats is as follows, where digit represents the radix set specified by the fmtflags argument value, and thousands-sep and decimal-point are the results of corresponding numpunct<charT> members.
Integer values have the format:
intval:
sign units
sign:
+
-
units:
digits
digits thousands-sep units
digits:
digit digits
and floating-point values have:
floatval:
sign units fractional exponent
sign decimal-point digits exponent
fractional:
decimal-point digits
exponent:
e sign digits
e:
e
E
where the number of digits between thousands-seps is as specified by do_grouping().
For parsing, if the digits portion contains no thousands-separators, no grouping constraint is applied.