Files
2025-10-25 03:02:53 +03:00

84 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[locale.numpunct.general]
# 28 Text processing library [[text]](./#text)
## 28.3 Localization library [[localization]](localization#locale.numpunct.general)
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.numpunct.general)
#### 28.3.4.4 The numeric punctuation facet [[facet.numpunct]](facet.numpunct#locale.numpunct.general)
#### 28.3.4.4.1 Class template numpunct [[locale.numpunct]](locale.numpunct#general)
#### 28.3.4.4.1.1 General [locale.numpunct.general]
[🔗](#lib:numpunct)
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(); // virtualvirtual 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 boolvirtual string_type do_falsename() const; // for bool};}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3137)
numpunct<> specifies numeric punctuation[.](#1.sentence-1)
The specializations
required in Table [91](locale.category#tab:locale.category.facets "Table 91: Locale category facets") ([[locale.category]](locale.category "28.3.3.1.2.1Type 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[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3153)
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[.](#2.sentence-1)
Integer values have the format:
intval :
[*sign*](lex.fcon#nt:sign "5.13.4Floating-point literals[lex.fcon]")opt units
[*sign*](lex.fcon#nt:sign "5.13.4Floating-point literals[lex.fcon]") :
+
-
units :
digits
digits thousands-sep units
digits :
[*digit*](lex.name#nt:digit "5.11Identifiers[lex.name]") digitsopt
and floating-point values have:
floatval :
[*sign*](lex.fcon#nt:sign "5.13.4Floating-point literals[lex.fcon]")opt units fractionalopt exponentopt
[*sign*](lex.fcon#nt:sign "5.13.4Floating-point literals[lex.fcon]")opt decimal-point digits exponentopt
fractional :
decimal-point digitsopt
exponent :
e [*sign*](lex.fcon#nt:sign "5.13.4Floating-point literals[lex.fcon]")opt digits
e :
e
E
where the number of digits between *thousands-sep**s* is as specified by do_grouping()[.](#2.sentence-2)
For parsing,
if the *digits* portion contains no thousands-separators,
no grouping constraint is applied[.](#2.sentence-3)