[facet.numpunct]

# 28 Text processing library [[text]](./#text)

## 28.3 Localization library [[localization]](localization#facet.numpunct)

### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#facet.numpunct)

#### 28.3.4.4 The numeric punctuation facet [facet.numpunct]

#### [28.3.4.4.1](#locale.numpunct) Class template numpunct [[locale.numpunct]](locale.numpunct)

#### [28.3.4.4.1.1](#locale.numpunct.general) General [[locale.numpunct.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](#locale.numpunct.general-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3137)

numpunct<> specifies numeric punctuation[.](#locale.numpunct.general-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.1 Type 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[.](#locale.numpunct.general-1.sentence-2)

[2](#locale.numpunct.general-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[.](#locale.numpunct.general-2.sentence-1)

Integer values have the format:

intval :  
[*sign*](lex.fcon#nt:sign "5.13.4 Floating-point literals [lex.fcon]")opt units

[*sign*](lex.fcon#nt:sign "5.13.4 Floating-point literals [lex.fcon]") :  
+  
-

units :  
digits  
digits thousands-sep units

digits :  
[*digit*](lex.name#nt:digit "5.11 Identifiers [lex.name]") digitsopt

and floating-point values have:

floatval :  
[*sign*](lex.fcon#nt:sign "5.13.4 Floating-point literals [lex.fcon]")opt units fractionalopt exponentopt  
[*sign*](lex.fcon#nt:sign "5.13.4 Floating-point literals [lex.fcon]")opt decimal-point digits exponentopt

fractional :  
decimal-point digitsopt

exponent :  
e [*sign*](lex.fcon#nt:sign "5.13.4 Floating-point literals [lex.fcon]")opt digits

e :  
e  
E

where the number of digits between *thousands-sep**s* is as specified by do_grouping()[.](#locale.numpunct.general-2.sentence-2)

For parsing,
if the *digits* portion contains no thousands-separators,
no grouping constraint is applied[.](#locale.numpunct.general-2.sentence-3)

#### [28.3.4.4.1.2](#members) Members [[facet.numpunct.members]](facet.numpunct.members)

[ð](#lib:numpunct,decimal_point)

`char_type decimal_point() const;
`

[1](#members-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3211)

*Returns*: do_decimal_point()[.](#members-1.sentence-1)

[ð](#lib:numpunct,thousands_sep)

`char_type thousands_sep() const;
`

[2](#members-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3222)

*Returns*: do_thousands_sep()[.](#members-2.sentence-1)

[ð](#lib:numpunct,grouping)

`string grouping() const;
`

[3](#members-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3233)

*Returns*: do_grouping()[.](#members-3.sentence-1)

[ð](#lib:numpunct,truename)

`string_type truename()  const;
string_type falsename() const;
`

[4](#members-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3246)

*Returns*: do_truename() ordo_falsename(),
respectively[.](#members-4.sentence-1)

#### [28.3.4.4.1.3](#virtuals) Virtual functions [[facet.numpunct.virtuals]](facet.numpunct.virtuals)

[ð](#lib:numpunct,do_decimal_point)

`char_type do_decimal_point() const;
`

[1](#virtuals-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3262)

*Returns*: A character for use as the decimal radix separator[.](#virtuals-1.sentence-1)

The required specializations return '.' or L'.'[.](#virtuals-1.sentence-2)

[ð](#lib:numpunct,do_thousands_sep)

`char_type do_thousands_sep() const;
`

[2](#virtuals-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3274)

*Returns*: A character for use as the digit group separator[.](#virtuals-2.sentence-1)

The required specializations return ',' or L','[.](#virtuals-2.sentence-2)

[ð](#lib:numpunct,do_grouping)

`string do_grouping() const;
`

[3](#virtuals-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3286)

*Returns*: A string vec used as a vector of integer values,
in which each element vec[i] represents the number of digits[225](#footnote-225 "Thus, the string &quot;\003&quot; specifies groups of 3 digits each, and &quot;3&quot; probably indicates groups of 51 (!) digits each, because 51 is the ASCII value of &quot;3&quot;.") in the group at position i,
starting with position 0 as the rightmost group[.](#virtuals-3.sentence-1)

If vec.size() <= i,
the number is the same as group (i - 1);
if (i < 0 || vec[i] <= 0 || vec[i] == CHAR_MAX),
the size of the digit group is unlimited[.](#virtuals-3.sentence-2)

[4](#virtuals-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3303)

The required specializations return the empty string, indicating no grouping[.](#virtuals-4.sentence-1)

[ð](#lib:numpunct,do_truename)

`string_type do_truename()  const;
string_type do_falsename() const;
`

[5](#virtuals-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3315)

*Returns*: A string representing the name of
the boolean value true or false, respectively[.](#virtuals-5.sentence-1)

[6](#virtuals-6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3320)

In the base class implementation
these names are "true" and "false",
or L"true" and L"false"[.](#virtuals-6.sentence-1)

[225)](#footnote-225)[225)](#footnoteref-225)

Thus,
the string "\003" specifies groups of 3 digits each, and"3" probably indicates groups of 51 (!) digits each,
because 51 is the ASCII value of "3"[.](#footnote-225.sentence-1)

#### [28.3.4.4.2](#locale.numpunct.byname) Class template numpunct_byname [[locale.numpunct.byname]](locale.numpunct.byname)

[ð](#lib:numpunct_byname)

namespace std {template<class charT>class numpunct_byname : public numpunct<charT> {// this class is specialized for char and wchar_t.public:using char_type = charT; using string_type = basic_string<charT>; explicit numpunct_byname(const char*, size_t refs = 0); explicit numpunct_byname(const string&, size_t refs = 0); protected:~numpunct_byname(); };}
