[locale.categories]

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

## 28.3 Localization library [[localization]](localization#locale.categories)

### 28.3.4 Standard locale categories [locale.categories]

#### [28.3.4.1](#general) General [[locale.categories.general]](locale.categories.general)

[1](#general-1)

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

Each of the standard categories includes a family of facets[.](#general-1.sentence-1)

Some of these implement formatting or parsing of a datum,
for use by standard or users' iostream operators << and >>,
as members put() and get(), respectively[.](#general-1.sentence-2)

Each such member function takes anios_base& argument whose membersflags(),precision(),
andwidth(),
specify the format of the corresponding datum ([[ios.base]](ios.base "31.5.2 Class ios_­base"))[.](#general-1.sentence-3)

Those functions which need to use other facets call its member getloc() to retrieve the locale imbued there[.](#general-1.sentence-4)

Formatting facets use the character argument fill to fill out the specified width where necessary[.](#general-1.sentence-5)

[2](#general-2)

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

The put() members make no provision for error reporting[.](#general-2.sentence-1)

(Any failures of the OutputIterator argument can be extracted from
the returned iterator[.](#general-2.sentence-2))

The get() members take an ios_base​::​iostate& argument
whose value they ignore,
but set to ios_base​::​failbit in case of a parse error[.](#general-2.sentence-3)

[3](#general-3)

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

Within [locale.categories] it is unspecified whether
one virtual function calls another virtual function[.](#general-3.sentence-1)

#### [28.3.4.2](#category.ctype) The ctype category [[category.ctype]](category.ctype)

#### [28.3.4.2.1](#category.ctype.general) General [[category.ctype.general]](category.ctype.general)

[ð](#lib:ctype_base)

namespace std {class ctype_base {public:using mask = *see below*; // numeric values are for exposition only.static constexpr mask space = 1 << 0; static constexpr mask print = 1 << 1; static constexpr mask cntrl = 1 << 2; static constexpr mask upper = 1 << 3; static constexpr mask lower = 1 << 4; static constexpr mask alpha = 1 << 5; static constexpr mask digit = 1 << 6; static constexpr mask punct = 1 << 7; static constexpr mask xdigit = 1 << 8; static constexpr mask blank = 1 << 9; static constexpr mask alnum = alpha | digit; static constexpr mask graph = alnum | punct; };}

[1](#category.ctype.general-1)

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

The type mask is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types"))[.](#category.ctype.general-1.sentence-1)

#### [28.3.4.2.2](#locale.ctype) Class template ctype [[locale.ctype]](locale.ctype)

#### [28.3.4.2.2.1](#locale.ctype.general) General [[locale.ctype.general]](locale.ctype.general)

[ð](#lib:ctype)

namespace std {template<class charT>class ctype : public locale::facet, public ctype_base {public:using char_type = charT; explicit ctype(size_t refs = 0); bool is(mask m, charT c) const; const charT* is(const charT* low, const charT* high, mask* vec) const; const charT* scan_is(mask m, const charT* low, const charT* high) const; const charT* scan_not(mask m, const charT* low, const charT* high) const;
 charT toupper(charT c) const; const charT* toupper(charT* low, const charT* high) const;
 charT tolower(charT c) const; const charT* tolower(charT* low, const charT* high) const;

 charT widen(char c) const; const char* widen(const char* low, const char* high, charT* to) const; char narrow(charT c, char dfault) const; const charT* narrow(const charT* low, const charT* high, char dfault, char* to) const; static locale::id id; protected:~ctype(); virtual bool do_is(mask m, charT c) const; virtual const charT* do_is(const charT* low, const charT* high, mask* vec) const; virtual const charT* do_scan_is(mask m, const charT* low, const charT* high) const; virtual const charT* do_scan_not(mask m, const charT* low, const charT* high) const; virtual charT do_toupper(charT) const; virtual const charT* do_toupper(charT* low, const charT* high) const; virtual charT do_tolower(charT) const; virtual const charT* do_tolower(charT* low, const charT* high) const; virtual charT do_widen(char) const; virtual const char* do_widen(const char* low, const char* high, charT* dest) const; virtual char do_narrow(charT, char dfault) const; virtual const charT* do_narrow(const charT* low, const charT* high, char dfault, char* dest) const; };}

[1](#locale.ctype.general-1)

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

Class ctype encapsulates the C library [<cctype>](cctype.syn#header:%3ccctype%3e "28.7.1 Header <cctype> synopsis [cctype.syn]") features[.](#locale.ctype.general-1.sentence-1)

istream members are required to use ctype<> for character classing during input parsing[.](#locale.ctype.general-1.sentence-2)

[2](#locale.ctype.general-2)

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

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 ctype<char> and ctype<wchar_t>,
implement character classing appropriate
to the implementation's native character set[.](#locale.ctype.general-2.sentence-1)

#### [28.3.4.2.2.2](#locale.ctype.members) ctype members [[locale.ctype.members]](locale.ctype.members)

[ð](#lib:ctype,is)

`bool         is(mask m, charT c) const;
const charT* is(const charT* low, const charT* high, mask* vec) const;
`

[1](#locale.ctype.members-1)

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

*Returns*: do_is(m, c) or do_is(low, high, vec)[.](#locale.ctype.members-1.sentence-1)

[ð](#lib:ctype,scan_is)

`const charT* scan_is(mask m, const charT* low, const charT* high) const;
`

[2](#locale.ctype.members-2)

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

*Returns*: do_scan_is(m, low, high)[.](#locale.ctype.members-2.sentence-1)

[ð](#lib:ctype,scan_not)

`const charT* scan_not(mask m, const charT* low, const charT* high) const;
`

[3](#locale.ctype.members-3)

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

*Returns*: do_scan_not(m, low, high)[.](#locale.ctype.members-3.sentence-1)

[ð](#lib:ctype,toupper)

`charT        toupper(charT c) const;
const charT* toupper(charT* low, const charT* high) const;
`

[4](#locale.ctype.members-4)

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

*Returns*: do_toupper(c) or do_toupper(low, high)[.](#locale.ctype.members-4.sentence-1)

[ð](#lib:ctype,tolower)

`charT        tolower(charT c) const;
const charT* tolower(charT* low, const charT* high) const;
`

[5](#locale.ctype.members-5)

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

*Returns*: do_tolower(c) or do_tolower(low, high)[.](#locale.ctype.members-5.sentence-1)

[ð](#lib:ctype,widen)

`charT       widen(char c) const;
const char* widen(const char* low, const char* high, charT* to) const;
`

[6](#locale.ctype.members-6)

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

*Returns*: do_widen(c) or do_widen(low, high, to)[.](#locale.ctype.members-6.sentence-1)

[ð](#lib:ctype,narrow)

`char         narrow(charT c, char dfault) const;
const charT* narrow(const charT* low, const charT* high, char dfault, char* to) const;
`

[7](#locale.ctype.members-7)

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

*Returns*: do_narrow(c, dfault) or do_narrow(low, high, dfault, to)[.](#locale.ctype.members-7.sentence-1)

#### [28.3.4.2.2.3](#locale.ctype.virtuals) ctype virtual functions [[locale.ctype.virtuals]](locale.ctype.virtuals)

[ð](#lib:ctype,do_is)

`bool         do_is(mask m, charT c) const;
const charT* do_is(const charT* low, const charT* high, mask* vec) const;
`

[1](#locale.ctype.virtuals-1)

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

*Effects*: Classifies a character or sequence of characters[.](#locale.ctype.virtuals-1.sentence-1)

For each argument character,
identifies a value M of type ctype_base​::​mask[.](#locale.ctype.virtuals-1.sentence-2)

The second form identifies a value M of type ctype_base​::​mask for each *p where (low <= p && p < high),
and places it into vec[p - low][.](#locale.ctype.virtuals-1.sentence-3)

[2](#locale.ctype.virtuals-2)

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

*Returns*: The first form returns the result of the expression (M & m) != 0;
i.e., true if the character has the characteristics specified[.](#locale.ctype.virtuals-2.sentence-1)

The second form returns high[.](#locale.ctype.virtuals-2.sentence-2)

[ð](#lib:ctype_base,do_scan_is)

`const charT* do_scan_is(mask m, const charT* low, const charT* high) const;
`

[3](#locale.ctype.virtuals-3)

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

*Effects*: Locates a character in a buffer that conforms to a classification m[.](#locale.ctype.virtuals-3.sentence-1)

[4](#locale.ctype.virtuals-4)

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

*Returns*: The smallest pointer p in the range [low, high)
such that is(m, *p) would return true;
otherwise, returns high[.](#locale.ctype.virtuals-4.sentence-1)

[ð](#lib:ctype,do_scan_not)

`const charT* do_scan_not(mask m, const charT* low, const charT* high) const;
`

[5](#locale.ctype.virtuals-5)

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

*Effects*: Locates a character in a buffer that fails to conform to a classificationm[.](#locale.ctype.virtuals-5.sentence-1)

[6](#locale.ctype.virtuals-6)

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

*Returns*: The smallest pointer p, if any, in the range [low, high)
such that is(m, *p) would return false;
otherwise, returns high[.](#locale.ctype.virtuals-6.sentence-1)

[ð](#lib:ctype,do_toupper)

`charT        do_toupper(charT c) const;
const charT* do_toupper(charT* low, const charT* high) const;
`

[7](#locale.ctype.virtuals-7)

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

*Effects*: Converts a character or characters to upper case[.](#locale.ctype.virtuals-7.sentence-1)

The second form replaces
each character *p in the range [low, high)
for which a corresponding upper-case character exists,
with that character[.](#locale.ctype.virtuals-7.sentence-2)

[8](#locale.ctype.virtuals-8)

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

*Returns*: The first form returns
the corresponding upper-case character if it is known to exist, or
its argument if not[.](#locale.ctype.virtuals-8.sentence-1)

The second form returns high[.](#locale.ctype.virtuals-8.sentence-2)

[ð](#lib:ctype,do_tolower)

`charT        do_tolower(charT c) const;
const charT* do_tolower(charT* low, const charT* high) const;
`

[9](#locale.ctype.virtuals-9)

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

*Effects*: Converts a character or characters to lower case[.](#locale.ctype.virtuals-9.sentence-1)

The second form replaces
each character *p in the range [low, high)
and for which a corresponding lower-case character exists,
with that character[.](#locale.ctype.virtuals-9.sentence-2)

[10](#locale.ctype.virtuals-10)

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

*Returns*: The first form returns
the corresponding lower-case character if it is known to exist, or
its argument if not[.](#locale.ctype.virtuals-10.sentence-1)

The second form returns high[.](#locale.ctype.virtuals-10.sentence-2)

[ð](#lib:ctype,do_widen)

`charT        do_widen(char c) const;
const char*  do_widen(const char* low, const char* high, charT* dest) const;
`

[11](#locale.ctype.virtuals-11)

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

*Effects*: Applies the simplest reasonable transformation
from a char value or sequence of char values
to the corresponding charT value or values[.](#locale.ctype.virtuals-11.sentence-1)[217](#footnote-217 "The parameter c of do_­widen is intended to accept values derived from character-literals for conversion to the locale's encoding.")

The only characters for which unique transformations are required
are those in the basic character set ([[lex.charset]](lex.charset "5.3.1 Character sets"))[.](#locale.ctype.virtuals-11.sentence-2)

For any named ctype category with
a ctype<char> facet ctc and
valid ctype_base​::​mask value M,(ctc.​is(M, c) || !is(M, do_widen(c)) ) is true[.](#locale.ctype.virtuals-11.sentence-3)[218](#footnote-218 "In other words, the transformed character is not a member of any character classification that c is not also a member of.")

The second form transforms
each character *p in the range [low, high),
placing the result in dest[p - low][.](#locale.ctype.virtuals-11.sentence-4)

[12](#locale.ctype.virtuals-12)

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

*Returns*: The first form returns the transformed value[.](#locale.ctype.virtuals-12.sentence-1)

The second form returns high[.](#locale.ctype.virtuals-12.sentence-2)

[ð](#lib:ctype,do_narrow)

`char         do_narrow(charT c, char dfault) const;
const charT* do_narrow(const charT* low, const charT* high, char dfault, char* dest) const;
`

[13](#locale.ctype.virtuals-13)

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

*Effects*: Applies the simplest reasonable transformation
from a charT value or sequence of charT values
to the corresponding char value or values[.](#locale.ctype.virtuals-13.sentence-1)

For any character c in the basic character set ([[lex.charset]](lex.charset "5.3.1 Character sets"))
the transformation is such thatdo_widen(do_narrow(c, 0)) == c

For any named ctype category with
a ctype<char> facet ctc however, andctype_base​::​mask value M,(is(M, c) || !ctc.is(M, do_narrow(c, dfault)) ) is true (unless do_narrow returns dfault)[.](#locale.ctype.virtuals-13.sentence-3)

In addition, for any digit character c,
the expression (do_narrow(c, dfault) - '0') evaluates to the digit value of the character[.](#locale.ctype.virtuals-13.sentence-4)

The second form transforms
each character *p in the range [low, high),
placing the result
(or dfault if no simple transformation is readily available)
in dest[p - low][.](#locale.ctype.virtuals-13.sentence-5)

[14](#locale.ctype.virtuals-14)

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

*Returns*: The first form returns the transformed value;
or dfault if no mapping is readily available[.](#locale.ctype.virtuals-14.sentence-1)

The second form returns high[.](#locale.ctype.virtuals-14.sentence-2)

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

The parameter c of do_widen is intended to
accept values derived from [*character-literal*](lex.ccon#nt:character-literal "5.13.3 Character literals [lex.ccon]")*s* for conversion to the locale's encoding[.](#footnote-217.sentence-1)

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

In other words, the transformed character is not
a member of any character classification
that c is not also a member of[.](#footnote-218.sentence-1)

#### [28.3.4.2.3](#locale.ctype.byname) Class template ctype_byname [[locale.ctype.byname]](locale.ctype.byname)

[ð](#lib:ctype_byname)

namespace std {template<class charT>class ctype_byname : public ctype<charT> {public:using mask = typename ctype<charT>::mask; explicit ctype_byname(const char*, size_t refs = 0); explicit ctype_byname(const string&, size_t refs = 0); protected:~ctype_byname(); };}

#### [28.3.4.2.4](#facet.ctype.special) ctype<char> specialization [[facet.ctype.special]](facet.ctype.special)

#### [28.3.4.2.4.1](#facet.ctype.special.general) General [[facet.ctype.special.general]](facet.ctype.special.general)

[ð](#lib:ctype%3cchar%3e)

namespace std {template<>class ctype<char> : public locale::facet, public ctype_base {public:using char_type = char; explicit ctype(const mask* tab = nullptr, bool del = false, size_t refs = 0); bool is(mask m, char c) const; const char* is(const char* low, const char* high, mask* vec) const; const char* scan_is (mask m, const char* low, const char* high) const; const char* scan_not(mask m, const char* low, const char* high) const; char toupper(char c) const; const char* toupper(char* low, const char* high) const; char tolower(char c) const; const char* tolower(char* low, const char* high) const; char widen(char c) const; const char* widen(const char* low, const char* high, char* to) const; char narrow(char c, char dfault) const; const char* narrow(const char* low, const char* high, char dfault, char* to) const; static locale::id id; static const size_t table_size = *implementation-defined*; const mask* table() const noexcept; static const mask* classic_table() noexcept; protected:~ctype(); virtual char do_toupper(char c) const; virtual const char* do_toupper(char* low, const char* high) const; virtual char do_tolower(char c) const; virtual const char* do_tolower(char* low, const char* high) const; virtual char do_widen(char c) const; virtual const char* do_widen(const char* low, const char* high, char* to) const; virtual char do_narrow(char c, char dfault) const; virtual const char* do_narrow(const char* low, const char* high, char dfault, char* to) const; };}

[1](#facet.ctype.special.general-1)

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

A specialization ctype<char> is provided
so that the member functions on type char can be implemented inline[.](#facet.ctype.special.general-1.sentence-1)[219](#footnote-219 "Only the char (not unsigned char and signed char) form is provided. The specialization is specified in the standard, and not left as an implementation detail, because it affects the derivation interface for ctype<char>.")

The implementation-defined value of
member table_size is at least 256[.](#facet.ctype.special.general-1.sentence-2)

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

Only the char (not unsigned char and signed char)
form is provided[.](#footnote-219.sentence-1)

The specialization is specified in the standard,
and not left as an implementation detail,
because it affects the derivation interface for ctype<char>[.](#footnote-219.sentence-2)

#### [28.3.4.2.4.2](#facet.ctype.char.dtor) Destructor [[facet.ctype.char.dtor]](facet.ctype.char.dtor)

[ð](#lib:ctype%3cchar%3e,destructor)

`~ctype();
`

[1](#facet.ctype.char.dtor-1)

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

*Effects*: If the constructor's first argument was nonzero, and
its second argument was true,
does delete [] table()[.](#facet.ctype.char.dtor-1.sentence-1)

#### [28.3.4.2.4.3](#facet.ctype.char.members) Members [[facet.ctype.char.members]](facet.ctype.char.members)

[1](#facet.ctype.char.members-1)

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

In the following member descriptions,
for unsigned char values v where v >= table_size,table()[v] is assumed to have an implementation-specific value
(possibly different for each such value v)
without performing the array lookup[.](#facet.ctype.char.members-1.sentence-1)

[ð](#lib:ctype%3cchar%3e,constructor)

`explicit ctype(const mask* tbl = nullptr, bool del = false, size_t refs = 0);
`

[2](#facet.ctype.char.members-2)

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

*Preconditions*: Either tbl == nullptr is true or
[tbl, tbl + table_size) is a valid range[.](#facet.ctype.char.members-2.sentence-1)

[3](#facet.ctype.char.members-3)

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

*Effects*: Passes its refs argument to its base class constructor[.](#facet.ctype.char.members-3.sentence-1)

[ð](#lib:ctype%3cchar%3e,is)

`bool        is(mask m, char c) const;
const char* is(const char* low, const char* high, mask* vec) const;
`

[4](#facet.ctype.char.members-4)

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

*Effects*: The second form, for all *p in the range [low, high),
assigns into vec[p - low] the value table()[(unsigned char)*p][.](#facet.ctype.char.members-4.sentence-1)

[5](#facet.ctype.char.members-5)

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

*Returns*: The first form returns table()[(unsigned char)c] & m;
the second form returns high[.](#facet.ctype.char.members-5.sentence-1)

[ð](#lib:ctype%3cchar%3e,scan_is)

`const char* scan_is(mask m, const char* low, const char* high) const;
`

[6](#facet.ctype.char.members-6)

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

*Returns*: The smallest p in the range [low, high) such thattable()[(unsigned char) *p] & m is true[.](#facet.ctype.char.members-6.sentence-1)

[ð](#lib:ctype%3cchar%3e,scan_not)

`const char* scan_not(mask m, const char* low, const char* high) const;
`

[7](#facet.ctype.char.members-7)

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

*Returns*: The smallest p in the range [low, high) such thattable()[(unsigned char) *p] & m is false[.](#facet.ctype.char.members-7.sentence-1)

[ð](#lib:ctype%3cchar%3e,toupper)

`char        toupper(char c) const;
const char* toupper(char* low, const char* high) const;
`

[8](#facet.ctype.char.members-8)

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

*Returns*: do_toupper(c) or do_toupper(low, high), respectively[.](#facet.ctype.char.members-8.sentence-1)

[ð](#lib:ctype%3cchar%3e,tolower)

`char        tolower(char c) const;
const char* tolower(char* low, const char* high) const;
`

[9](#facet.ctype.char.members-9)

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

*Returns*: do_tolower(c) or do_tolower(low, high), respectively[.](#facet.ctype.char.members-9.sentence-1)

[ð](#lib:ctype%3cchar%3e,widen)

`char  widen(char c) const;
const char* widen(const char* low, const char* high, char* to) const;
`

[10](#facet.ctype.char.members-10)

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

*Returns*: do_widen(c) ordo_widen(low, high, to), respectively[.](#facet.ctype.char.members-10.sentence-1)

[ð](#lib:ctype%3cchar%3e,narrow)

`char        narrow(char c, char dfault) const;
const char* narrow(const char* low, const char* high, char dfault, char* to) const;
`

[11](#facet.ctype.char.members-11)

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

*Returns*: do_narrow(c, dfault) ordo_narrow(low, high, dfault, to),
respectively[.](#facet.ctype.char.members-11.sentence-1)

[ð](#lib:ctype%3cchar%3e,table)

`const mask* table() const noexcept;
`

[12](#facet.ctype.char.members-12)

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

*Returns*: The first constructor argument, if it was nonzero,
otherwise classic_table()[.](#facet.ctype.char.members-12.sentence-1)

#### [28.3.4.2.4.4](#facet.ctype.char.statics) Static members [[facet.ctype.char.statics]](facet.ctype.char.statics)

[ð](#lib:ctype%3cchar%3e,classic_table)

`static const mask* classic_table() noexcept;
`

[1](#facet.ctype.char.statics-1)

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

*Returns*: A pointer to the initial element of an array of size table_size which represents the classifications of characters in the "C" locale[.](#facet.ctype.char.statics-1.sentence-1)

#### [28.3.4.2.4.5](#facet.ctype.char.virtuals) Virtual functions [[facet.ctype.char.virtuals]](facet.ctype.char.virtuals)

[ð](#lib:ctype%3cchar%3e,do_toupper)

char do_toupper(char) const;const char* do_toupper(char* low, const char* high) const;char do_tolower(char) const;const char* do_tolower(char* low, const char* high) const;

virtual char do_widen(char c) const;virtual const char* do_widen(const char* low, const char* high, char* to) const;virtual char do_narrow(char c, char dfault) const;virtual const char* do_narrow(const char* low, const char* high, char dfault, char* to) const;

[1](#facet.ctype.char.virtuals-1)

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

These functions are described identically as those members of the same name
in the ctype class template ([[locale.ctype.members]](#locale.ctype.members "28.3.4.2.2.2 ctype members"))[.](#facet.ctype.char.virtuals-1.sentence-1)

#### [28.3.4.2.5](#locale.codecvt) Class template codecvt [[locale.codecvt]](locale.codecvt)

#### [28.3.4.2.5.1](#locale.codecvt.general) General [[locale.codecvt.general]](locale.codecvt.general)

[ð](#lib:codecvt)

namespace std {class codecvt_base {public:enum result { ok, partial, error, noconv }; }; template<class internT, class externT, class stateT>class codecvt : public locale::facet, public codecvt_base {public:using intern_type = internT; using extern_type = externT; using state_type = stateT; explicit codecvt(size_t refs = 0);

 result out( stateT& state, const internT* from, const internT* from_end, const internT*& from_next,
 externT* to, externT* to_end, externT*& to_next) const;

 result unshift( stateT& state,
 externT* to, externT* to_end, externT*& to_next) const;

 result in( stateT& state, const externT* from, const externT* from_end, const externT*& from_next,
 internT* to, internT* to_end, internT*& to_next) const; int encoding() const noexcept; bool always_noconv() const noexcept; int length(stateT&, const externT* from, const externT* end, size_t max) const; int max_length() const noexcept; static locale::id id; protected:~codecvt(); virtual result do_out( stateT& state, const internT* from, const internT* from_end, const internT*& from_next,
 externT* to, externT* to_end, externT*& to_next) const; virtual result do_in( stateT& state, const externT* from, const externT* from_end, const externT*& from_next,
 internT* to, internT* to_end, internT*& to_next) const; virtual result do_unshift( stateT& state,
 externT* to, externT* to_end, externT*& to_next) const; virtual int do_encoding() const noexcept; virtual bool do_always_noconv() const noexcept; virtual int do_length(stateT&, const externT* from, const externT* end, size_t max) const; virtual int do_max_length() const noexcept; };}

[1](#locale.codecvt.general-1)

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

The class codecvt<internT, externT, stateT> is for use
when converting from one character encoding to another,
such as from wide characters to multibyte characters or
between wide character encodings such as UTF-32 and EUC[.](#locale.codecvt.general-1.sentence-1)

[2](#locale.codecvt.general-2)

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

The stateT argument selects
the pair of character encodings being mapped between[.](#locale.codecvt.general-2.sentence-1)

[3](#locale.codecvt.general-3)

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

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"))
convert the implementation-defined native character set[.](#locale.codecvt.general-3.sentence-1)

codecvt<char, char, mbstate_t> implements a degenerate conversion;
it does not convert at all[.](#locale.codecvt.general-3.sentence-2)

codecvt<wchar_t, char, mbstate_t> converts between the native character sets for ordinary and wide characters[.](#locale.codecvt.general-3.sentence-3)

Specializations on mbstate_t perform conversion between encodings known to the library implementer[.](#locale.codecvt.general-3.sentence-4)

Other encodings can be converted by specializing on
a program-defined stateT type[.](#locale.codecvt.general-3.sentence-5)

Objects of type stateT can contain any state
that is useful to communicate to or from
the specialized do_in or do_out members[.](#locale.codecvt.general-3.sentence-6)

#### [28.3.4.2.5.2](#locale.codecvt.members) Members [[locale.codecvt.members]](locale.codecvt.members)

[ð](#lib:codecvt,out)

`result out(
  stateT& state,
  const internT* from, const internT* from_end, const internT*& from_next,
  externT* to, externT* to_end, externT*& to_next) const;
`

[1](#locale.codecvt.members-1)

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

*Returns*: do_out(state, from, from_end, from_next, to, to_end, to_next)[.](#locale.codecvt.members-1.sentence-1)

[ð](#lib:codecvt,unshift)

`result unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
`

[2](#locale.codecvt.members-2)

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

*Returns*: do_unshift(state, to, to_end, to_next)[.](#locale.codecvt.members-2.sentence-1)

[ð](#lib:codecvt,in)

`result in(
  stateT& state,
  const externT* from, const externT* from_end, const externT*& from_next,
  internT* to, internT* to_end, internT*& to_next) const;
`

[3](#locale.codecvt.members-3)

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

*Returns*: do_in(state, from, from_end, from_next, to, to_end, to_next)[.](#locale.codecvt.members-3.sentence-1)

[ð](#lib:codecvt,encoding)

`int encoding() const noexcept;
`

[4](#locale.codecvt.members-4)

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

*Returns*: do_encoding()[.](#locale.codecvt.members-4.sentence-1)

[ð](#lib:codecvt,always_noconv)

`bool always_noconv() const noexcept;
`

[5](#locale.codecvt.members-5)

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

*Returns*: do_always_noconv()[.](#locale.codecvt.members-5.sentence-1)

[ð](#lib:codecvt,length)

`int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
`

[6](#locale.codecvt.members-6)

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

*Returns*: do_length(state, from, from_end, max)[.](#locale.codecvt.members-6.sentence-1)

[ð](#lib:codecvt,max_length)

`int max_length() const noexcept;
`

[7](#locale.codecvt.members-7)

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

*Returns*: do_max_length()[.](#locale.codecvt.members-7.sentence-1)

#### [28.3.4.2.5.3](#locale.codecvt.virtuals) Virtual functions [[locale.codecvt.virtuals]](locale.codecvt.virtuals)

[ð](#lib:codecvt,do_out)

`result do_out(
  stateT& state,
  const internT* from, const internT* from_end, const internT*& from_next,
  externT* to, externT* to_end, externT*& to_next) const;

result do_in(
  stateT& state,
  const externT* from, const externT* from_end, const externT*& from_next,
  internT* to, internT* to_end, internT*& to_next) const;
`

[1](#locale.codecvt.virtuals-1)

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

*Preconditions*: (from <= from_end && to <= to_end) is well-defined and true;state is initialized, if at the beginning of a sequence,
or else is equal to the result of converting
the preceding characters in the sequence[.](#locale.codecvt.virtuals-1.sentence-1)

[2](#locale.codecvt.virtuals-2)

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

*Effects*: Translates characters in the source range [from, from_end),
placing the results in sequential positions starting at destination to[.](#locale.codecvt.virtuals-2.sentence-1)

Converts no more than (from_end - from) source elements, and
stores no more than (to_end - to) destination elements[.](#locale.codecvt.virtuals-2.sentence-2)

[3](#locale.codecvt.virtuals-3)

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

Stops if it encounters a character it cannot convert[.](#locale.codecvt.virtuals-3.sentence-1)

It always leaves the from_next and to_next pointers
pointing one beyond the last element successfully converted[.](#locale.codecvt.virtuals-3.sentence-2)

If it returns noconv,internT and externT are the same type, and
the converted sequence is identical to
the input sequence [from, from_next),to_next is set equal to to,
the value of state is unchanged, and
there are no changes to the values in [to, to_end)[.](#locale.codecvt.virtuals-3.sentence-3)

[4](#locale.codecvt.virtuals-4)

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

A codecvt facet
that is used by basic_filebuf ([[file.streams]](file.streams "31.10 File-based streams"))
shall have the property that ifdo_out(state, from, from_end, from_next, to, to_end, to_next) would return ok,
where from != from_end,
thendo_out(state, from, from + 1, from_next, to, to_end, to_next) shall also return ok,
and that ifdo_in(state, from, from_end, from_next, to, to_end, to_next) would return ok,
where to != to_end,
thendo_in(state, from, from_end, from_next, to, to + 1, to_next) shall also return ok[.](#locale.codecvt.virtuals-4.sentence-1)[220](#footnote-220 "Informally, this means that basic_­filebuf assumes that the mappings from internal to external characters is 1 to N: that a codecvt facet that is used by basic_­filebuf can translate characters one internal character at a time.")

[*Note [1](#locale.codecvt.virtuals-note-1)*:

As a result of operations on state,
it can return ok or partial and
set from_next == from and to_next != to[.](#locale.codecvt.virtuals-4.sentence-2)

â *end note*]

[5](#locale.codecvt.virtuals-5)

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

*Returns*: An enumeration value, as summarized in Table [93](#tab:locale.codecvt.inout "Table 93: do_­in/do_­out result values")[.](#locale.codecvt.virtuals-5.sentence-1)

Table [93](#tab:locale.codecvt.inout) — do_in/do_out result values [[tab:locale.codecvt.inout]](./tab:locale.codecvt.inout)  

| [ð](#tab:locale.codecvt.inout-row-1)<br>**Value** | **Meaning** |
| --- | --- |
| [ð](#tab:locale.codecvt.inout-row-2)<br>ok | completed the conversion |
| [ð](#tab:locale.codecvt.inout-row-3)<br>partial | not all source characters converted |
| [ð](#tab:locale.codecvt.inout-row-4)<br>error | encountered a character in [from, from_end) that cannot be converted |
| [ð](#tab:locale.codecvt.inout-row-5)<br>noconv | internT and externT are the same type, and input sequence is identical to converted sequence |

A return value of partial,
if (from_next == from_end),
indicates
that either the destination sequence has not absorbed
all the available destination elements, or
that additional source elements are needed
before another destination element can be produced[.](#locale.codecvt.virtuals-5.sentence-2)

[6](#locale.codecvt.virtuals-6)

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

*Remarks*: Its operations on state are unspecified[.](#locale.codecvt.virtuals-6.sentence-1)

[*Note [2](#locale.codecvt.virtuals-note-2)*:

This argument can be used, for example,
to maintain shift state,
to specify conversion options (such as count only), or
to identify a cache of seek offsets[.](#locale.codecvt.virtuals-6.sentence-2)

â *end note*]

[ð](#lib:codecvt,do_unshift)

`result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
`

[7](#locale.codecvt.virtuals-7)

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

*Preconditions*: (to <= to_end) is well-defined and true;state is initialized, if at the beginning of a sequence,
or else is equal to the result of converting
the preceding characters in the sequence[.](#locale.codecvt.virtuals-7.sentence-1)

[8](#locale.codecvt.virtuals-8)

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

*Effects*: Places characters starting at to that should be appended to terminate a sequence
when the current stateT is given by state[.](#locale.codecvt.virtuals-8.sentence-1)[221](#footnote-221 "Typically these will be characters to return the state to stateT().")

Stores no more than (to_end - to) destination elements, and
leaves the to_next pointer
pointing one beyond the last element successfully stored[.](#locale.codecvt.virtuals-8.sentence-2)

[9](#locale.codecvt.virtuals-9)

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

*Returns*: An enumeration value, as summarized in Table [94](#tab:locale.codecvt.unshift "Table 94: do_­unshift result values")[.](#locale.codecvt.virtuals-9.sentence-1)

Table [94](#tab:locale.codecvt.unshift) — do_unshift result values [[tab:locale.codecvt.unshift]](./tab:locale.codecvt.unshift)  

| [ð](#tab:locale.codecvt.unshift-row-1)<br>**Value** | **Meaning** |
| --- | --- |
| [ð](#tab:locale.codecvt.unshift-row-2)<br>ok | completed the sequence |
| [ð](#tab:locale.codecvt.unshift-row-3)<br>partial | space for more than to_end - to destination elements was needed to terminate a sequence given the value of state |
| [ð](#tab:locale.codecvt.unshift-row-4)<br>error | an unspecified error has occurred |
| [ð](#tab:locale.codecvt.unshift-row-5)<br>noconv | no termination is needed for this state_type |

[ð](#lib:codecvt,do_encoding)

`int do_encoding() const noexcept;
`

[10](#locale.codecvt.virtuals-10)

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

*Returns*: -1 if the encoding of the externT sequence is state-dependent;
else the constant number of externT characters
needed to produce an internal character;
or 0 if this number is not a constant[.](#locale.codecvt.virtuals-10.sentence-1)[222](#footnote-222 "If encoding() yields -1, then more than max_­length() externT elements can be consumed when producing a single internT character, and additional externT elements can appear at the end of a sequence after those that yield the final internT character.")

[ð](#lib:codecvt,do_always_noconv)

`bool do_always_noconv() const noexcept;
`

[11](#locale.codecvt.virtuals-11)

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

*Returns*: true if do_in() and do_out() return noconv for all valid argument values[.](#locale.codecvt.virtuals-11.sentence-1)

codecvt<char, char, mbstate_t> returns true[.](#locale.codecvt.virtuals-11.sentence-2)

[ð](#lib:codecvt,do_length)

`int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
`

[12](#locale.codecvt.virtuals-12)

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

*Preconditions*: (from <= from_end) is well-defined and true;state is initialized, if at the beginning of a sequence,
or else is equal to the result of converting
the preceding characters in the sequence[.](#locale.codecvt.virtuals-12.sentence-1)

[13](#locale.codecvt.virtuals-13)

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

*Effects*: The effect on the state argument is as if
it called do_in(state, from, from_end, from, to, to + max, to) for to pointing to a buffer of at least max elements[.](#locale.codecvt.virtuals-13.sentence-1)

[14](#locale.codecvt.virtuals-14)

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

*Returns*: (from_next - from) wherefrom_next is the largest value in the range [from, from_end]
such that the sequence of values in the range [from, from_next)
representsmax or fewer valid complete characters of type internT[.](#locale.codecvt.virtuals-14.sentence-1)

The specialization codecvt<char, char, mbstate_t>,
returns the lesser of max and (from_end - from)[.](#locale.codecvt.virtuals-14.sentence-2)

[ð](#lib:codecvt,do_max_length)

`int do_max_length() const noexcept;
`

[15](#locale.codecvt.virtuals-15)

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

*Returns*: The maximum value that do_length(state, from, from_end, 1) can return
for any valid range [from, from_end)
and stateT value state[.](#locale.codecvt.virtuals-15.sentence-1)

The specialization codecvt<char, char, mbstate_t>​::​do_max_length() returns 1[.](#locale.codecvt.virtuals-15.sentence-2)

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

Informally, this means that basic_filebuf assumes that the mappings from internal to external characters is 1 to N:
that a codecvt facet that is used by basic_filebuf can translate characters one internal character at a time[.](#footnote-220.sentence-1)

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

Typically these will be characters to return the state to stateT()[.](#footnote-221.sentence-1)

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

If encoding() yields -1,
then more than max_length() externT elements
can be consumed when producing a single internT character, and
additional externT elements can appear at the end of a sequence
after those that yield the final internT character[.](#footnote-222.sentence-1)

#### [28.3.4.2.6](#locale.codecvt.byname) Class template codecvt_byname [[locale.codecvt.byname]](locale.codecvt.byname)

[ð](#lib:codecvt_byname)

namespace std {template<class internT, class externT, class stateT>class codecvt_byname : public codecvt<internT, externT, stateT> {public:explicit codecvt_byname(const char*, size_t refs = 0); explicit codecvt_byname(const string&, size_t refs = 0); protected:~codecvt_byname(); };}

#### [28.3.4.3](#category.numeric) The numeric category [[category.numeric]](category.numeric)

#### [28.3.4.3.1](#category.numeric.general) General [[category.numeric.general]](category.numeric.general)

[1](#category.numeric.general-1)

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

The classes num_get<> and num_put<> handle numeric formatting and parsing[.](#category.numeric.general-1.sentence-1)

Virtual functions are provided for several numeric types[.](#category.numeric.general-1.sentence-2)

Implementations may (but are not required to) delegate
extraction of smaller types to extractors for larger types[.](#category.numeric.general-1.sentence-3)[223](#footnote-223 "Parsing &quot;-1&quot; correctly into, e.g., an unsigned short requires that the corresponding member get() at least extract the sign before delegating.")

[2](#category.numeric.general-2)

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

All specifications of member functions for num_put and num_get in the subclauses of [[category.numeric]](#category.numeric "28.3.4.3 The numeric category") only apply to
the specializations required in Tables [91](locale.category#tab:locale.category.facets "Table 91: Locale category facets") and [92](locale.category#tab:locale.spec "Table 92: Required specializations") ([[locale.category]](locale.category "28.3.3.1.2.1 Type locale​::​category")), namelynum_get<char>,num_get<wchar_t>,num_get<C, InputIterator>,num_put<char>,num_put<wchar_t>, andnum_put<C, OutputIterator>[.](#category.numeric.general-2.sentence-1)

These specializations refer to the ios_base& argument for
formatting specifications ([locale.categories]),
and to its imbued locale for the numpunct<> facet to
identify all numeric punctuation preferences,
and also for the ctype<> facet to perform character classification[.](#category.numeric.general-2.sentence-2)

[3](#category.numeric.general-3)

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

Extractor and inserter members of the standard iostreams usenum_get<> and num_put<> member functions for
formatting and parsing
numeric values ([[istream.formatted.reqmts]](istream.formatted.reqmts "31.7.5.3.1 Common requirements"), [[ostream.formatted.reqmts]](ostream.formatted.reqmts "31.7.6.3.1 Common requirements"))[.](#category.numeric.general-3.sentence-1)

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

Parsing "-1" correctly into, e.g., an unsigned short requires that the corresponding member get() at least extract the sign before delegating[.](#footnote-223.sentence-1)

#### [28.3.4.3.2](#locale.num.get) Class template num_get [[locale.num.get]](locale.num.get)

#### [28.3.4.3.2.1](#locale.num.get.general) General [[locale.num.get.general]](locale.num.get.general)

[ð](#lib:num_get)

namespace std {template<class charT, class InputIterator = istreambuf_iterator<charT>>class num_get : public locale::facet {public:using char_type = charT; using iter_type = InputIterator; explicit num_get(size_t refs = 0);

 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, bool& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, long& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, long long& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, unsigned short& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, unsigned int& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, unsigned long& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, unsigned long long& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, float& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, double& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, long double& v) const;
 iter_type get(iter_type in, iter_type end, ios_base&,
 ios_base::iostate& err, void*& v) const; static locale::id id; protected:~num_get(); virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, bool& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, long& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, long long& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, unsigned short& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, unsigned int& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, unsigned long& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, unsigned long long& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, float& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, double& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, long double& v) const; virtual iter_type do_get(iter_type, iter_type, ios_base&,
 ios_base::iostate& err, void*& v) const; };}

[1](#locale.num.get.general-1)

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

The facet num_get is used to parse numeric values
from an input sequence such as an istream[.](#locale.num.get.general-1.sentence-1)

#### [28.3.4.3.2.2](#facet.num.get.members) Members [[facet.num.get.members]](facet.num.get.members)

[ð](#lib:num_get,get)

`iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, bool& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, long long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, unsigned short& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, unsigned int& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, unsigned long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, unsigned long long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, float& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, double& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, long double& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
              ios_base::iostate& err, void*& val) const;
`

[1](#facet.num.get.members-1)

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

*Returns*: do_get(in, end, str, err, val)[.](#facet.num.get.members-1.sentence-1)

#### [28.3.4.3.2.3](#facet.num.get.virtuals) Virtual functions [[facet.num.get.virtuals]](facet.num.get.virtuals)

[ð](#lib:num_get,do_get)

`iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, long long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, unsigned short& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, unsigned int& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, unsigned long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, unsigned long long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, float& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, double& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, long double& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, void*& val) const;
`

[1](#facet.num.get.virtuals-1)

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

*Effects*: Reads characters from in,
interpreting them according tostr.flags(),use_facet<ctype<​charT>>(loc), anduse_facet<numpunct<charT>>(loc),
where loc is str.getloc()[.](#facet.num.get.virtuals-1.sentence-1)

[2](#facet.num.get.virtuals-2)

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

The details of this operation occur in three stages:

- [(2.1)](#facet.num.get.virtuals-2.1)

  Stage 1:
Determine a conversion specifier[.](#facet.num.get.virtuals-2.1.sentence-1)

- [(2.2)](#facet.num.get.virtuals-2.2)

  Stage 2:
Extract characters from in and
determine a corresponding char value for
the format expected by the conversion specification determined in stage 1[.](#facet.num.get.virtuals-2.2.sentence-1)

- [(2.3)](#facet.num.get.virtuals-2.3)

  Stage 3:
Store results[.](#facet.num.get.virtuals-2.3.sentence-1)

[3](#facet.num.get.virtuals-3)

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

The details of the stages are presented below[.](#facet.num.get.virtuals-3.sentence-1)

- [Stage 1:](#facet.num.get.virtuals-3.1)
  The function initializes local variables viafmtflags flags = str.flags();
fmtflags basefield = (flags & ios_base::basefield);
fmtflags uppercase = (flags & ios_base::uppercase);
fmtflags boolalpha = (flags & ios_base::boolalpha);
  For conversion to an integral type,
the function determines the integral conversion specifier
as indicated in Table [95](#tab:facet.num.get.int "Table 95: Integer conversions")[.](#facet.num.get.virtuals-3.1.sentence-2)
  The table is ordered[.](#facet.num.get.virtuals-3.1.sentence-3)
  That is, the first line whose condition is true applies[.](#facet.num.get.virtuals-3.1.sentence-4)
  Table [95](#tab:facet.num.get.int) — Integer conversions [[tab:facet.num.get.int]](./tab:facet.num.get.int)  

| [ð](#tab:facet.num.get.int-row-1)<br>   **State** | **stdio equivalent** |
| --- | --- |
| [ð](#tab:facet.num.get.int-row-2)<br>   basefield == oct | %o |
| [ð](#tab:facet.num.get.int-row-3)<br>   basefield == hex | %X |
| [ð](#tab:facet.num.get.int-row-4)<br>   basefield == 0 | %i |
| [ð](#tab:facet.num.get.int-row-5)<br>   signed integral type | %d |
| [ð](#tab:facet.num.get.int-row-6)<br>   unsigned integral type | %u |

  For conversions to a floating-point type the specifier is %g[.](#facet.num.get.virtuals-3.1.sentence-5)
  For conversions to void* the specifier is %p[.](#facet.num.get.virtuals-3.1.sentence-6)
  A length modifier is added to the conversion specification, if needed,
as indicated in Table [96](#tab:facet.num.get.length "Table 96: Length modifier")[.](#facet.num.get.virtuals-3.1.sentence-7)
  Table [96](#tab:facet.num.get.length) — Length modifier [[tab:facet.num.get.length]](./tab:facet.num.get.length)  

| [ð](#tab:facet.num.get.length-row-1)<br>   **Type** | **Length modifier** |
| --- | --- |
| [ð](#tab:facet.num.get.length-row-2)<br>   short | h |
| [ð](#tab:facet.num.get.length-row-3)<br>   unsigned short | h |
| [ð](#tab:facet.num.get.length-row-4)<br>   long | l |
| [ð](#tab:facet.num.get.length-row-5)<br>   unsigned long | l |
| [ð](#tab:facet.num.get.length-row-6)<br>   long long | ll |
| [ð](#tab:facet.num.get.length-row-7)<br>   unsigned long long | ll |
| [ð](#tab:facet.num.get.length-row-8)<br>   double | l |
| [ð](#tab:facet.num.get.length-row-9)<br>   long double | L |

- [Stage 2:](#facet.num.get.virtuals-3.2)
  If in == end then stage 2 terminates[.](#facet.num.get.virtuals-3.2.sentence-1)
  Otherwise a charT is taken from in and
local variables are initialized as if bychar_type ct = *in;char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];if (ct == use_facet<numpunct<charT>>(loc).decimal_point()) c = '.';bool discard = ct == use_facet<numpunct<charT>>(loc).thousands_sep()&& use_facet<numpunct<charT>>(loc).grouping().length() != 0; where the values src and atoms are defined as if by:static const char src[] = "0123456789abcdefpxABCDEFPX+-";
char_type atoms[sizeof(src)];
use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms); for this value of loc[.](#facet.num.get.virtuals-3.2.sentence-2)
  If discard is true,
then if '.' has not yet been accumulated,
then the position of the character is remembered,
but the character is otherwise ignored[.](#facet.num.get.virtuals-3.2.sentence-3)
  Otherwise, if '.' has already been accumulated,
the character is discarded and Stage 2 terminates[.](#facet.num.get.virtuals-3.2.sentence-4)
  If it is not discarded,
then a check is made to determine
if c is allowed as the next character of
an input field of the conversion specifier returned by Stage 1[.](#facet.num.get.virtuals-3.2.sentence-5)
  If so, it is accumulated[.](#facet.num.get.virtuals-3.2.sentence-6)
  If the character is either discarded or accumulated
then in is advanced by ++in and processing returns to the beginning of stage 2[.](#facet.num.get.virtuals-3.2.sentence-7)
  [*Example [1](#facet.num.get.virtuals-example-1)*:
  Given an input sequence of "0x1a.bp+07p",
  * [(3.2.1)](#facet.num.get.virtuals-3.2.1)

if the conversion specifier returned by Stage 1 is %d,"0" is accumulated;

  * [(3.2.2)](#facet.num.get.virtuals-3.2.2)

if the conversion specifier returned by Stage 1 is %i,"0x1a" are accumulated;

  * [(3.2.3)](#facet.num.get.virtuals-3.2.3)

if the conversion specifier returned by Stage 1 is %g,"0x1a.bp+07" are accumulated[.](#facet.num.get.virtuals-3.2.sentence-8)

   In all cases, the remainder is left in the input[.](#facet.num.get.virtuals-3.2.sentence-9)
 â *end example*]

- [Stage 3:](#facet.num.get.virtuals-3.3)
  The sequence of chars accumulated in stage 2 (the field)
is converted to a numeric value by the rules of one of the functions
declared in the header [<cstdlib>](cstdlib.syn#header:%3ccstdlib%3e "17.2.2 Header <cstdlib> synopsis [cstdlib.syn]"):

  * [(3.3.1)](#facet.num.get.virtuals-3.3.1)

      For a signed integer value, the function strtoll[.](#facet.num.get.virtuals-3.3.1.sentence-1)

  * [(3.3.2)](#facet.num.get.virtuals-3.3.2)

      For an unsigned integer value, the function strtoull[.](#facet.num.get.virtuals-3.3.2.sentence-1)

  * [(3.3.3)](#facet.num.get.virtuals-3.3.3)

      For a float value, the function strtof[.](#facet.num.get.virtuals-3.3.3.sentence-1)

  * [(3.3.4)](#facet.num.get.virtuals-3.3.4)

      For a double value, the function strtod[.](#facet.num.get.virtuals-3.3.4.sentence-1)

  * [(3.3.5)](#facet.num.get.virtuals-3.3.5)

      For a long double value, the function strtold[.](#facet.num.get.virtuals-3.3.5.sentence-1)

  The numeric value to be stored can be one of:
  * [(3.3.6)](#facet.num.get.virtuals-3.3.6)

      zero, if the conversion function does not convert the entire field[.](#facet.num.get.virtuals-3.3.6.sentence-1)

  * [(3.3.7)](#facet.num.get.virtuals-3.3.7)

      the most positive (or negative) representable value,
if the field to be converted to a signed integer type represents a value
too large positive (or negative) to be represented in val[.](#facet.num.get.virtuals-3.3.7.sentence-1)

  * [(3.3.8)](#facet.num.get.virtuals-3.3.8)

      the most positive representable value,
if the field to be converted to an unsigned integer type represents a value
that cannot be represented in val[.](#facet.num.get.virtuals-3.3.8.sentence-1)

  * [(3.3.9)](#facet.num.get.virtuals-3.3.9)

      the converted value, otherwise[.](#facet.num.get.virtuals-3.3.9.sentence-1)

  The resultant numeric value is stored in val[.](#facet.num.get.virtuals-3.3.sentence-3)
  If the conversion function does not convert the entire field, or
if the field represents a value outside the range of representable values,ios_base​::​failbit is assigned to err[.](#facet.num.get.virtuals-3.3.sentence-4)

[4](#facet.num.get.virtuals-4)

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

Digit grouping is checked[.](#facet.num.get.virtuals-4.sentence-1)

That is, the positions of discarded
separators are examined for consistency withuse_facet<numpunct<charT>>(loc).grouping()[.](#facet.num.get.virtuals-4.sentence-2)

If they are not consistent
then ios_base​::​failbit is assigned to err[.](#facet.num.get.virtuals-4.sentence-3)

[5](#facet.num.get.virtuals-5)

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

In any case,
if stage 2 processing was terminated by the test for in == end then err |= ios_base​::​eofbit is performed[.](#facet.num.get.virtuals-5.sentence-1)

[ð](#lib:do_get,num_get_)

`iter_type do_get(iter_type in, iter_type end, ios_base& str,
                 ios_base::iostate& err, bool& val) const;
`

[6](#facet.num.get.virtuals-6)

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

*Effects*: If (str.flags() & ios_base​::​boolalpha) == 0 then input proceeds as it would for a long except that if a value is being stored into val,
the value is determined according to the following:
If the value to be stored is 0 then false is stored[.](#facet.num.get.virtuals-6.sentence-1)

If the value is 1 then true is stored[.](#facet.num.get.virtuals-6.sentence-2)

Otherwise true is stored andios_base​::​failbit is assigned to err[.](#facet.num.get.virtuals-6.sentence-3)

[7](#facet.num.get.virtuals-7)

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

Otherwise target sequences are determined âas ifâ by
calling the members falsename() and truename() of
the facet obtained by use_facet<numpunct<charT>>(str.getloc())[.](#facet.num.get.virtuals-7.sentence-1)

Successive characters in the range [in, end) (see [[sequence.reqmts]](sequence.reqmts "23.2.4 Sequence containers"))
are obtained and matched against
corresponding positions in the target sequences
only as necessary to identify a unique match[.](#facet.num.get.virtuals-7.sentence-2)

The input iterator in is compared to end only when necessary to obtain a character[.](#facet.num.get.virtuals-7.sentence-3)

If a target sequence is uniquely matched,val is set to the corresponding value[.](#facet.num.get.virtuals-7.sentence-4)

Otherwise false is stored andios_base​::​failbit is assigned to err[.](#facet.num.get.virtuals-7.sentence-5)

[8](#facet.num.get.virtuals-8)

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

The in iterator is always left pointing one position beyond
the last character successfully matched[.](#facet.num.get.virtuals-8.sentence-1)

If val is set, then err is set to str.goodbit;
or to str.eofbit if,
when seeking another character to match,
it is found that (in == end)[.](#facet.num.get.virtuals-8.sentence-2)

If val is not set, then err is set to str.failbit;
or to (str.failbit | str.eofbit) if the reason for the failure was that (in == end)[.](#facet.num.get.virtuals-8.sentence-3)

[*Example [2](#facet.num.get.virtuals-example-2)*:

For targets true: "a" and false: "abb",
the input sequence "a" yieldsval == true and err == str.eofbit;
the input sequence "abc" yieldserr = str.failbit, with in ending at the 'c' element[.](#facet.num.get.virtuals-8.sentence-4)

For targets true: "1" and false: "0",
the input sequence "1" yieldsval == true and err == str.goodbit[.](#facet.num.get.virtuals-8.sentence-5)

For empty targets (""),
any input sequence yields err == str.failbit[.](#facet.num.get.virtuals-8.sentence-6)

â *end example*]

[9](#facet.num.get.virtuals-9)

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

*Returns*: in[.](#facet.num.get.virtuals-9.sentence-1)

#### [28.3.4.3.3](#locale.nm.put) Class template num_put [[locale.nm.put]](locale.nm.put)

#### [28.3.4.3.3.1](#locale.nm.put.general) General [[locale.nm.put.general]](locale.nm.put.general)

[ð](#lib:num_put)

namespace std {template<class charT, class OutputIterator = ostreambuf_iterator<charT>>class num_put : public locale::facet {public:using char_type = charT; using iter_type = OutputIterator; explicit num_put(size_t refs = 0);

 iter_type put(iter_type s, ios_base& f, char_type fill, bool v) const;
 iter_type put(iter_type s, ios_base& f, char_type fill, long v) const;
 iter_type put(iter_type s, ios_base& f, char_type fill, long long v) const;
 iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long v) const;
 iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long long v) const;
 iter_type put(iter_type s, ios_base& f, char_type fill, double v) const;
 iter_type put(iter_type s, ios_base& f, char_type fill, long double v) const;
 iter_type put(iter_type s, ios_base& f, char_type fill, const void* v) const; static locale::id id; protected:~num_put(); virtual iter_type do_put(iter_type, ios_base&, char_type fill, bool v) const; virtual iter_type do_put(iter_type, ios_base&, char_type fill, long v) const; virtual iter_type do_put(iter_type, ios_base&, char_type fill, long long v) const; virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long) const; virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long long) const; virtual iter_type do_put(iter_type, ios_base&, char_type fill, double v) const; virtual iter_type do_put(iter_type, ios_base&, char_type fill, long double v) const; virtual iter_type do_put(iter_type, ios_base&, char_type fill, const void* v) const; };}

[1](#locale.nm.put.general-1)

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

The facetnum_put is used to format numeric values to a character sequence such as an ostream[.](#locale.nm.put.general-1.sentence-1)

#### [28.3.4.3.3.2](#facet.num.put.members) Members [[facet.num.put.members]](facet.num.put.members)

[ð](#lib:num_put,put)

`iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, double val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long double val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
`

[1](#facet.num.put.members-1)

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

*Returns*: do_put(out, str, fill, val)[.](#facet.num.put.members-1.sentence-1)

#### [28.3.4.3.3.3](#facet.num.put.virtuals) Virtual functions [[facet.num.put.virtuals]](facet.num.put.virtuals)

[ð](#lib:num_put,do_put)

`iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, double val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, long double val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val) const;
`

[1](#facet.num.put.virtuals-1)

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

*Effects*: Writes characters to the sequence out,
formatting val as desired[.](#facet.num.put.virtuals-1.sentence-1)

In the following description, loc names a local variable initialized aslocale loc = str.getloc();

[2](#facet.num.put.virtuals-2)

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

The details of this operation occur in several stages:

- [(2.1)](#facet.num.put.virtuals-2.1)

  Stage 1:
Determine a printf conversion specifier spec and
determine the characters
that would be printed by printf ([[c.files]](c.files "31.13 C library files"))
given this conversion specifier forprintf(spec, val) assuming that the current locale is the "C" locale[.](#facet.num.put.virtuals-2.1.sentence-1)

- [(2.2)](#facet.num.put.virtuals-2.2)

  Stage 2:
Adjust the representation by converting
each char determined by stage 1 to a charT using a conversion and
values returned by members of use_facet<numpunct<charT>>(loc)[.](#facet.num.put.virtuals-2.2.sentence-1)

- [(2.3)](#facet.num.put.virtuals-2.3)

  Stage 3:
Determine where padding is required[.](#facet.num.put.virtuals-2.3.sentence-1)

- [(2.4)](#facet.num.put.virtuals-2.4)

  Stage 4:
Insert the sequence into the out[.](#facet.num.put.virtuals-2.4.sentence-1)

[3](#facet.num.put.virtuals-3)

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

Detailed descriptions of each stage follow[.](#facet.num.put.virtuals-3.sentence-1)

[4](#facet.num.put.virtuals-4)

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

*Returns*: out[.](#facet.num.put.virtuals-4.sentence-1)

[5](#facet.num.put.virtuals-5)

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

- [Stage 1:](#facet.num.put.virtuals-5.1)
  The first action of stage 1 is to determine a conversion specifier[.](#facet.num.put.virtuals-5.1.sentence-1)
  The tables that describe this determination use the following local variables
  fmtflags flags = str.flags();
fmtflags basefield = (flags & (ios_base::basefield));
fmtflags uppercase = (flags & (ios_base::uppercase));
fmtflags floatfield = (flags & (ios_base::floatfield));
fmtflags showpos = (flags & (ios_base::showpos));
fmtflags showbase = (flags & (ios_base::showbase));
fmtflags showpoint = (flags & (ios_base::showpoint));
  All tables used in describing stage 1 are ordered[.](#facet.num.put.virtuals-5.1.sentence-3)
  That is, the first line whose condition is true applies[.](#facet.num.put.virtuals-5.1.sentence-4)
  A line without a condition is the default behavior
when none of the earlier lines apply[.](#facet.num.put.virtuals-5.1.sentence-5)
  For conversion from an integral type other than a character type,
the function determines the integral conversion specifier
as indicated in Table [97](#tab:facet.num.put.int "Table 97: Integer conversions")[.](#facet.num.put.virtuals-5.1.sentence-6)
  Table [97](#tab:facet.num.put.int) — Integer conversions [[tab:facet.num.put.int]](./tab:facet.num.put.int)  

| [ð](#tab:facet.num.put.int-row-1)<br>   **State** | **stdio equivalent** |
| --- | --- |
| [ð](#tab:facet.num.put.int-row-2)<br>   basefield == ios_base​::​oct | %o |
| [ð](#tab:facet.num.put.int-row-3)<br>   (basefield == ios_base​::​hex) && !uppercase | %x |
| [ð](#tab:facet.num.put.int-row-4)<br>   (basefield == ios_base​::​hex) | %X |
| [ð](#tab:facet.num.put.int-row-5)<br>   for a signed integral type | %d |
| [ð](#tab:facet.num.put.int-row-6)<br>   for an unsigned integral type | %u |

  For conversion from a floating-point type,
the function determines the floating-point conversion specifier
as indicated in Table [98](#tab:facet.num.put.fp "Table 98: Floating-point conversions")[.](#facet.num.put.virtuals-5.1.sentence-7)
  Table [98](#tab:facet.num.put.fp) — Floating-point conversions [[tab:facet.num.put.fp]](./tab:facet.num.put.fp)  

| [ð](#tab:facet.num.put.fp-row-1)<br>   **State** | **stdio equivalent** |
| --- | --- |
| [ð](#tab:facet.num.put.fp-row-2)<br>   floatfield == ios_base​::​fixed && !uppercase | %f |
| [ð](#tab:facet.num.put.fp-row-3)<br>   floatfield == ios_base​::​fixed | %F |
| [ð](#tab:facet.num.put.fp-row-4)<br>   floatfield == ios_base​::​scientific && !uppercase | %e |
| [ð](#tab:facet.num.put.fp-row-5)<br>   floatfield == ios_base​::​scientific | %E |
| [ð](#tab:facet.num.put.fp-row-6)<br>   floatfield == (ios_base​::​fixed | ios_base​::​scientific) && !uppercase | %a |
| [ð](#tab:facet.num.put.fp-row-7)<br>   floatfield == (ios_base​::​fixed | ios_base​::​scientific) | %A |
| [ð](#tab:facet.num.put.fp-row-8)<br>   !uppercase | %g |
| [ð](#tab:facet.num.put.fp-row-9)<br>   *otherwise* | %G |

  For conversions from an integral or floating-point type
a length modifier is added to the conversion specifier
as indicated in Table [99](#tab:facet.num.put.length "Table 99: Length modifier")[.](#facet.num.put.virtuals-5.1.sentence-8)
  Table [99](#tab:facet.num.put.length) — Length modifier [[tab:facet.num.put.length]](./tab:facet.num.put.length)  

| [ð](#tab:facet.num.put.length-row-1)<br>   **Type** | **Length modifier** |
| --- | --- |
| [ð](#tab:facet.num.put.length-row-2)<br>   long | l |
| [ð](#tab:facet.num.put.length-row-3)<br>   long long | ll |
| [ð](#tab:facet.num.put.length-row-4)<br>   unsigned long | l |
| [ð](#tab:facet.num.put.length-row-5)<br>   unsigned long long | ll |
| [ð](#tab:facet.num.put.length-row-6)<br>   long double | L |
| [ð](#tab:facet.num.put.length-row-7)<br>   *otherwise* | *none* |

  The conversion specifier has the following optional additional qualifiers
prepended as indicated in Table [100](#tab:facet.num.put.conv "Table 100: Numeric conversions")[.](#facet.num.put.virtuals-5.1.sentence-9)
  Table [100](#tab:facet.num.put.conv) — Numeric conversions [[tab:facet.num.put.conv]](./tab:facet.num.put.conv)  

| [ð](#tab:facet.num.put.conv-row-1)<br>   **Type(s)** | **State** | **stdio equivalent** |
| --- | --- | --- |
| [ð](#tab:facet.num.put.conv-row-2)<br>   an integral type | showpos | + |
| [ð](#tab:facet.num.put.conv-row-3) | showbase | # |
| [ð](#tab:facet.num.put.conv-row-4)<br>   a floating-point type | showpos | + |
| [ð](#tab:facet.num.put.conv-row-5) | showpoint | # |

  For conversion from a floating-point type,
if floatfield != (ios_base​::​fixed | ios_base​::​​scientific),str.precision() is specified as precision
in the conversion specification[.](#facet.num.put.virtuals-5.1.sentence-10)
  Otherwise, no precision is specified[.](#facet.num.put.virtuals-5.1.sentence-11)
  For conversion from void* the specifier is %p[.](#facet.num.put.virtuals-5.1.sentence-12)
  The representations at the end of stage 1 consists of the char's
that would be printed by a call of printf(s, val) where s is the conversion specifier determined above[.](#facet.num.put.virtuals-5.1.sentence-13)

- [Stage 2:](#facet.num.put.virtuals-5.2)
  Any character c other than a decimal point(.) is converted to
a charT viause_facet<ctype<charT>>(loc).widen(c)
  A local variable punct is initialized viaconst numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
  For arithmetic types,punct.thousands_sep() characters are inserted into
the sequence as determined by the value returned by punct.do_grouping() using the method described in [[facet.numpunct.virtuals]](#facet.numpunct.virtuals "28.3.4.4.1.3 Virtual functions")[.](#facet.num.put.virtuals-5.2.sentence-3)
  Decimal point characters(.) are replaced by punct.decimal_point()[.](#facet.num.put.virtuals-5.2.sentence-4)

- [Stage 3:](#facet.num.put.virtuals-5.3)
  A local variable is initialized asfmtflags adjustfield = (flags & (ios_base::adjustfield));
  The location of any padding[224](#footnote-224 "The conversion specification #o generates a leading 0 which is not a padding character.") is determined according to Table [101](#tab:facet.num.put.fill "Table 101: Fill padding")[.](#facet.num.put.virtuals-5.3.sentence-2)
  Table [101](#tab:facet.num.put.fill) — Fill padding [[tab:facet.num.put.fill]](./tab:facet.num.put.fill)  

| [ð](#tab:facet.num.put.fill-row-1)<br>   **State** | **Location** |
| --- | --- |
| [ð](#tab:facet.num.put.fill-row-2)<br>   adjustfield == ios_base​::​left | pad after |
| [ð](#tab:facet.num.put.fill-row-3)<br>   adjustfield == ios_base​::​right | pad before |
| [ð](#tab:facet.num.put.fill-row-4)<br>   adjustfield == internal and a sign occurs in the representation | pad after the sign |
| [ð](#tab:facet.num.put.fill-row-5)<br>   adjustfield == internal and representation after stage 1 began with 0x or 0X | pad after x or X |
| [ð](#tab:facet.num.put.fill-row-6)<br>   *otherwise* | pad before |

  If str.width() is nonzero and the number of charT's
in the sequence after stage 2 is less than str.​width(),
then enough fill characters are added to the sequence
at the position indicated for padding
to bring the length of the sequence to str.width()[.](#facet.num.put.virtuals-5.3.sentence-3)
  str.width(0) is called[.](#facet.num.put.virtuals-5.3.sentence-4)

- [Stage 4:](#facet.num.put.virtuals-5.4)
  The sequence of charT's at the end of stage 3 are output via*out++ = c

[ð](#lib:do_put,num_put_)

`iter_type do_put(iter_type out, ios_base& str, char_type fill, bool val) const;
`

[6](#facet.num.put.virtuals-6)

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

*Returns*: If (str.flags() & ios_base​::​boolalpha) == 0 returns do_put(out, str, fill,  
(int)val),
otherwise obtains a string s as if bystring_type s = val ? use_facet<numpunct<charT>>(loc).truename(): use_facet<numpunct<charT>>(loc).falsename(); and then inserts each character c of s into out via *out++ = c and returns out[.](#facet.num.put.virtuals-6.sentence-1)

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

The conversion specification #o generates a leading 0 which is *not* a padding character[.](#footnote-224.sentence-1)

#### [28.3.4.4](#facet.numpunct) The numeric punctuation facet [[facet.numpunct]](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](#facet.numpunct.members) Members [[facet.numpunct.members]](facet.numpunct.members)

[ð](#lib:numpunct,decimal_point)

`char_type decimal_point() const;
`

[1](#facet.numpunct.members-1)

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

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

[ð](#lib:numpunct,thousands_sep)

`char_type thousands_sep() const;
`

[2](#facet.numpunct.members-2)

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

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

[ð](#lib:numpunct,grouping)

`string grouping() const;
`

[3](#facet.numpunct.members-3)

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

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

[ð](#lib:numpunct,truename)

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

[4](#facet.numpunct.members-4)

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

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

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

[ð](#lib:numpunct,do_decimal_point)

`char_type do_decimal_point() const;
`

[1](#facet.numpunct.virtuals-1)

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

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

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

[ð](#lib:numpunct,do_thousands_sep)

`char_type do_thousands_sep() const;
`

[2](#facet.numpunct.virtuals-2)

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

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

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

[ð](#lib:numpunct,do_grouping)

`string do_grouping() const;
`

[3](#facet.numpunct.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[.](#facet.numpunct.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[.](#facet.numpunct.virtuals-3.sentence-2)

[4](#facet.numpunct.virtuals-4)

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

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

[ð](#lib:numpunct,do_truename)

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

[5](#facet.numpunct.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[.](#facet.numpunct.virtuals-5.sentence-1)

[6](#facet.numpunct.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"[.](#facet.numpunct.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(); };}

#### [28.3.4.5](#category.collate) The collate category [[category.collate]](category.collate)

#### [28.3.4.5.1](#locale.collate) Class template collate [[locale.collate]](locale.collate)

#### [28.3.4.5.1.1](#locale.collate.general) General [[locale.collate.general]](locale.collate.general)

[ð](#lib:collate)

namespace std {template<class charT>class collate : public locale::facet {public:using char_type = charT; using string_type = basic_string<charT>; explicit collate(size_t refs = 0); int compare(const charT* low1, const charT* high1, const charT* low2, const charT* high2) const;
 string_type transform(const charT* low, const charT* high) const; long hash(const charT* low, const charT* high) const; static locale::id id; protected:~collate(); virtual int do_compare(const charT* low1, const charT* high1, const charT* low2, const charT* high2) const; virtual string_type do_transform(const charT* low, const charT* high) const; virtual long do_hash (const charT* low, const charT* high) const; };}

[1](#locale.collate.general-1)

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

The class collate<charT> provides features
for use in the collation (comparison) and hashing of strings[.](#locale.collate.general-1.sentence-1)

A locale member function template, operator(),
uses the collate facet to allow a locale to act directly as
the predicate argument for standard algorithms ([[algorithms]](algorithms "26 Algorithms library")) and
containers operating on strings[.](#locale.collate.general-1.sentence-2)

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 collate<char> and collate<wchar_t>,
apply lexicographical ordering ([[alg.lex.comparison]](alg.lex.comparison "26.8.11 Lexicographical comparison"))[.](#locale.collate.general-1.sentence-3)

[2](#locale.collate.general-2)

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

Each function compares a string of characters *p in the range [low, high)[.](#locale.collate.general-2.sentence-1)

#### [28.3.4.5.1.2](#locale.collate.members) Members [[locale.collate.members]](locale.collate.members)

[ð](#lib:collate,compare)

`int compare(const charT* low1, const charT* high1,
            const charT* low2, const charT* high2) const;
`

[1](#locale.collate.members-1)

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

*Returns*: do_compare(low1, high1, low2, high2)[.](#locale.collate.members-1.sentence-1)

[ð](#lib:collate,transform)

`string_type transform(const charT* low, const charT* high) const;
`

[2](#locale.collate.members-2)

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

*Returns*: do_transform(low, high)[.](#locale.collate.members-2.sentence-1)

[ð](#lib:collate,hash)

`long hash(const charT* low, const charT* high) const;
`

[3](#locale.collate.members-3)

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

*Returns*: do_hash(low, high)[.](#locale.collate.members-3.sentence-1)

#### [28.3.4.5.1.3](#locale.collate.virtuals) Virtual functions [[locale.collate.virtuals]](locale.collate.virtuals)

[ð](#lib:collate,do_compare)

`int do_compare(const charT* low1, const charT* high1,
               const charT* low2, const charT* high2) const;
`

[1](#locale.collate.virtuals-1)

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

*Returns*: 1 if the first string is greater than the second,-1 if less,
zero otherwise[.](#locale.collate.virtuals-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 collate<char> and collate<wchar_t>,
implement a lexicographical comparison ([[alg.lex.comparison]](alg.lex.comparison "26.8.11 Lexicographical comparison"))[.](#locale.collate.virtuals-1.sentence-2)

[ð](#lib:collate,do_transform)

`string_type do_transform(const charT* low, const charT* high) const;
`

[2](#locale.collate.virtuals-2)

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

*Returns*: A basic_string<charT> value that,
compared lexicographically with
the result of calling transform() on another string,
yields the same result as calling do_compare() on the same two strings[.](#locale.collate.virtuals-2.sentence-1)[226](#footnote-226 "This function is useful when one string is being compared to many other strings.")

[ð](#lib:collate,do_hash)

`long do_hash(const charT* low, const charT* high) const;
`

[3](#locale.collate.virtuals-3)

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

*Returns*: An integer value equal to the result of calling hash() on any other string for which do_compare() returns 0 (equal)
when passed the two strings[.](#locale.collate.virtuals-3.sentence-1)

[4](#locale.collate.virtuals-4)

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

*Recommended practice*: The probability that the result equals that for another string
which does not compare equal should be very small,
approaching (1.0/numeric_limits<unsigned long>​::​max())[.](#locale.collate.virtuals-4.sentence-1)

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

This function is useful when one string is being compared to many other strings[.](#footnote-226.sentence-1)

#### [28.3.4.5.2](#locale.collate.byname) Class template collate_byname [[locale.collate.byname]](locale.collate.byname)

[ð](#lib:collate_byname)

namespace std {template<class charT>class collate_byname : public collate<charT> {public:using string_type = basic_string<charT>; explicit collate_byname(const char*, size_t refs = 0); explicit collate_byname(const string&, size_t refs = 0); protected:~collate_byname(); };}

#### [28.3.4.6](#category.time) The time category [[category.time]](category.time)

#### [28.3.4.6.1](#category.time.general) General [[category.time.general]](category.time.general)

[1](#category.time.general-1)

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

Templatestime_get<charT, InputIterator> andtime_put<charT, OutputIterator> provide date and time formatting and parsing[.](#category.time.general-1.sentence-1)

All specifications of member functions for time_put and time_get in the subclauses of [[category.time]](#category.time "28.3.4.6 The time category") only apply to the
specializations required in Tables [91](locale.category#tab:locale.category.facets "Table 91: Locale category facets") and [92](locale.category#tab:locale.spec "Table 92: Required specializations") ([[locale.category]](locale.category "28.3.3.1.2.1 Type locale​::​category"))[.](#category.time.general-1.sentence-2)

Their members use theirios_base&, ios_base​::​iostate&, and fill arguments
as described in [locale.categories],
and the ctype<> facet,
to determine formatting details[.](#category.time.general-1.sentence-3)

#### [28.3.4.6.2](#locale.time.get) Class template time_get [[locale.time.get]](locale.time.get)

#### [28.3.4.6.2.1](#locale.time.get.general) General [[locale.time.get.general]](locale.time.get.general)

[ð](#lib:time_get)

namespace std {class time_base {public:enum dateorder { no_order, dmy, mdy, ymd, ydm }; }; template<class charT, class InputIterator = istreambuf_iterator<charT>>class time_get : public locale::facet, public time_base {public:using char_type = charT; using iter_type = InputIterator; explicit time_get(size_t refs = 0);

 dateorder date_order() const { return do_date_order(); } iter_type get_time(iter_type s, iter_type end, ios_base& f,
 ios_base::iostate& err, tm* t) const;
 iter_type get_date(iter_type s, iter_type end, ios_base& f,
 ios_base::iostate& err, tm* t) const;
 iter_type get_weekday(iter_type s, iter_type end, ios_base& f,
 ios_base::iostate& err, tm* t) const;
 iter_type get_monthname(iter_type s, iter_type end, ios_base& f,
 ios_base::iostate& err, tm* t) const;
 iter_type get_year(iter_type s, iter_type end, ios_base& f,
 ios_base::iostate& err, tm* t) const;
 iter_type get(iter_type s, iter_type end, ios_base& f,
 ios_base::iostate& err, tm* t, char format, char modifier = 0) const;
 iter_type get(iter_type s, iter_type end, ios_base& f,
 ios_base::iostate& err, tm* t, const char_type* fmt, const char_type* fmtend) const; static locale::id id; protected:~time_get(); virtual dateorder do_date_order() const; virtual iter_type do_get_time(iter_type s, iter_type end, ios_base&,
 ios_base::iostate& err, tm* t) const; virtual iter_type do_get_date(iter_type s, iter_type end, ios_base&,
 ios_base::iostate& err, tm* t) const; virtual iter_type do_get_weekday(iter_type s, iter_type end, ios_base&,
 ios_base::iostate& err, tm* t) const; virtual iter_type do_get_monthname(iter_type s, iter_type end, ios_base&,
 ios_base::iostate& err, tm* t) const; virtual iter_type do_get_year(iter_type s, iter_type end, ios_base&,
 ios_base::iostate& err, tm* t) const; virtual iter_type do_get(iter_type s, iter_type end, ios_base& f,
 ios_base::iostate& err, tm* t, char format, char modifier) const; };}

[1](#locale.time.get.general-1)

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

time_get is used to parse a character sequence,
extracting components of a time or date into a tm object[.](#locale.time.get.general-1.sentence-1)

Each get member parses a format as produced by a corresponding format specifier totime_put<>​::​put[.](#locale.time.get.general-1.sentence-2)

If the sequence being parsed matches the correct format, the corresponding
members of thetm argument are set to the values used to produce the sequence; otherwise
either an error is reported or unspecified values are assigned[.](#locale.time.get.general-1.sentence-3)[227](#footnote-227 "In other words, user confirmation is required for reliable parsing of user-entered dates and times, but machine-generated formats can be parsed reliably. This allows parsers to be aggressive about interpreting user variations on standard formats.")

[2](#locale.time.get.general-2)

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

If the end iterator is reached during parsing by any of theget() member functions, the member setsios_base​::​eofbit in err[.](#locale.time.get.general-2.sentence-1)

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

In
other words, user confirmation is required for reliable parsing of
user-entered dates and times, but machine-generated formats can be
parsed reliably[.](#footnote-227.sentence-1)

This allows parsers to be aggressive about
interpreting user variations on standard formats[.](#footnote-227.sentence-2)

#### [28.3.4.6.2.2](#locale.time.get.members) Members [[locale.time.get.members]](locale.time.get.members)

[ð](#lib:time_get,date_order)

`dateorder date_order() const;
`

[1](#locale.time.get.members-1)

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

*Returns*: do_date_order()[.](#locale.time.get.members-1.sentence-1)

[ð](#lib:time_get,get_time)

`iter_type get_time(iter_type s, iter_type end, ios_base& str,
                   ios_base::iostate& err, tm* t) const;
`

[2](#locale.time.get.members-2)

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

*Returns*: do_get_time(s, end, str, err, t)[.](#locale.time.get.members-2.sentence-1)

[ð](#lib:time_get,get_date)

`iter_type get_date(iter_type s, iter_type end, ios_base& str,
                   ios_base::iostate& err, tm* t) const;
`

[3](#locale.time.get.members-3)

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

*Returns*: do_get_date(s, end, str, err, t)[.](#locale.time.get.members-3.sentence-1)

[ð](#lib:time_get,get_weekday)

`iter_type get_weekday(iter_type s, iter_type end, ios_base& str,
                      ios_base::iostate& err, tm* t) const;
iter_type get_monthname(iter_type s, iter_type end, ios_base& str,
                        ios_base::iostate& err, tm* t) const;
`

[4](#locale.time.get.members-4)

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

*Returns*: do_get_weekday(s, end, str, err, t) ordo_get_monthname(s, end, str, err, t)[.](#locale.time.get.members-4.sentence-1)

[ð](#lib:time_get,get_year)

`iter_type get_year(iter_type s, iter_type end, ios_base& str,
                   ios_base::iostate& err, tm* t) const;
`

[5](#locale.time.get.members-5)

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

*Returns*: do_get_year(s, end, str, err, t)[.](#locale.time.get.members-5.sentence-1)

[ð](#lib:get,time_get)

`iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
              tm* t, char format, char modifier = 0) const;
`

[6](#locale.time.get.members-6)

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

*Returns*: do_get(s, end, f, err, t, format, modifier)[.](#locale.time.get.members-6.sentence-1)

[ð](#lib:get,time_get_)

`iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
              tm* t, const char_type* fmt, const char_type* fmtend) const;
`

[7](#locale.time.get.members-7)

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

*Preconditions*: [fmt, fmtend) is a valid range[.](#locale.time.get.members-7.sentence-1)

[8](#locale.time.get.members-8)

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

*Effects*: The function starts by evaluating err = ios_base​::​goodbit[.](#locale.time.get.members-8.sentence-1)

It then enters a loop,
reading zero or more characters from s at each iteration[.](#locale.time.get.members-8.sentence-2)

Unless otherwise specified below,
the loop terminates when the first of the following conditions holds:

- [(8.1)](#locale.time.get.members-8.1)

  The expression fmt == fmtend evaluates to true[.](#locale.time.get.members-8.1.sentence-1)

- [(8.2)](#locale.time.get.members-8.2)

  The expression err == ios_base​::​goodbit evaluates to false[.](#locale.time.get.members-8.2.sentence-1)

- [(8.3)](#locale.time.get.members-8.3)

  The expression s == end evaluates to true,
in which case
the function evaluates err = ios_base​::​eofbit | ios_base​::​failbit[.](#locale.time.get.members-8.3.sentence-1)

- [(8.4)](#locale.time.get.members-8.4)

  The next element of fmt is equal to '%',
optionally followed by a modifier character,
followed by a conversion specifier character, format,
together forming a conversion specification
valid for the POSIX function strptime[.](#locale.time.get.members-8.4.sentence-1)
  If the number of elements in the range [fmt, fmtend)
is not sufficient to unambiguously determine
whether the conversion specification is complete and valid,
the function evaluates err = ios_base​::​failbit[.](#locale.time.get.members-8.4.sentence-2)
  Otherwise,
the function evaluates s = do_get(s, end, f, err, t, format, modifier),
where the value of modifier is '\0' when the optional modifier is absent from the conversion specification[.](#locale.time.get.members-8.4.sentence-3)
  If err == ios_base​::​goodbit holds
after the evaluation of the expression,
the function increments fmt to point just past the end of the conversion specification and
continues looping[.](#locale.time.get.members-8.4.sentence-4)

- [(8.5)](#locale.time.get.members-8.5)

  The expression isspace(*fmt, f.getloc()) evaluates to true,
in which case the function first increments fmt untilfmt == fmtend || !isspace(*fmt, f.getloc()) evaluates to true,
then advances s until s == end || !isspace(*s, f.getloc()) is true, and
finally resumes looping[.](#locale.time.get.members-8.5.sentence-1)

- [(8.6)](#locale.time.get.members-8.6)

  The next character read from s matches the element pointed to by fmt in a case-insensitive comparison,
in which case the function evaluates ++fmt, ++s and continues looping[.](#locale.time.get.members-8.6.sentence-1)
  Otherwise, the function evaluates err = ios_base​::​failbit[.](#locale.time.get.members-8.6.sentence-2)

[9](#locale.time.get.members-9)

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

[*Note [1](#locale.time.get.members-note-1)*:

The function uses the ctype<charT> facet
installed in f's locale
to determine valid whitespace characters[.](#locale.time.get.members-9.sentence-1)

It is unspecified
by what means the function performs case-insensitive comparison or
whether multi-character sequences are considered while doing so[.](#locale.time.get.members-9.sentence-2)

â *end note*]

[10](#locale.time.get.members-10)

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

*Returns*: s[.](#locale.time.get.members-10.sentence-1)

#### [28.3.4.6.2.3](#locale.time.get.virtuals) Virtual functions [[locale.time.get.virtuals]](locale.time.get.virtuals)

[ð](#lib:time_get,do_date_order)

`dateorder do_date_order() const;
`

[1](#locale.time.get.virtuals-1)

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

*Returns*: An enumeration value indicating the preferred order of components
for those date formats that are composed of day, month, and year[.](#locale.time.get.virtuals-1.sentence-1)[228](#footnote-228 "This function is intended as a convenience only, for common formats, and can return no_­order in valid locales.")

Returns no_order if the date format specified by 'x' contains other variable components (e.g., Julian day, week number, week day)[.](#locale.time.get.virtuals-1.sentence-2)

[ð](#lib:time_get,do_get_time)

`iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
                      ios_base::iostate& err, tm* t) const;
`

[2](#locale.time.get.virtuals-2)

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

*Effects*: Reads characters starting at s until it has extracted those tm members, and
remaining format characters,
used by time_put<>​::​put to produce the format specified by "%H:%M:%S",
or until it encounters an error or end of sequence[.](#locale.time.get.virtuals-2.sentence-1)

[3](#locale.time.get.virtuals-3)

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

*Returns*: An iterator pointing immediately beyond
the last character recognized as possibly part of a valid time[.](#locale.time.get.virtuals-3.sentence-1)

[ð](#lib:time_get,do_get_date)

`iter_type do_get_date(iter_type s, iter_type end, ios_base& str,
                      ios_base::iostate& err, tm* t) const;
`

[4](#locale.time.get.virtuals-4)

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

*Effects*: Reads characters starting at s until it has extracted those tm members and
remaining format characters
used by time_put<>​::​put to produce one of the following formats,
or until it encounters an error[.](#locale.time.get.virtuals-4.sentence-1)

The format depends on the value returned by date_order() as shown in Table [102](#tab:locale.time.get.dogetdate "Table 102: do_­get_­date effects")[.](#locale.time.get.virtuals-4.sentence-2)

Table [102](#tab:locale.time.get.dogetdate) — do_get_date effects [[tab:locale.time.get.dogetdate]](./tab:locale.time.get.dogetdate)  

| [ð](#tab:locale.time.get.dogetdate-row-1)<br>**date_order()** | **Format** |
| --- | --- |
| [ð](#tab:locale.time.get.dogetdate-row-2)<br>no_order | "%m%d%y" |
| [ð](#tab:locale.time.get.dogetdate-row-3)<br>dmy | "%d%m%y" |
| [ð](#tab:locale.time.get.dogetdate-row-4)<br>mdy | "%m%d%y" |
| [ð](#tab:locale.time.get.dogetdate-row-5)<br>ymd | "%y%m%d" |
| [ð](#tab:locale.time.get.dogetdate-row-6)<br>ydm | "%y%d%m" |

[5](#locale.time.get.virtuals-5)

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

An implementation may also accept additionalimplementation-defined formats[.](#locale.time.get.virtuals-5.sentence-1)

[6](#locale.time.get.virtuals-6)

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

*Returns*: An iterator pointing immediately beyond
the last character recognized as possibly part of a valid date[.](#locale.time.get.virtuals-6.sentence-1)

[ð](#lib:time_get,do_get_weekday)

`iter_type do_get_weekday(iter_type s, iter_type end, ios_base& str,
                         ios_base::iostate& err, tm* t) const;
iter_type do_get_monthname(iter_type s, iter_type end, ios_base& str,
                           ios_base::iostate& err, tm* t) const;
`

[7](#locale.time.get.virtuals-7)

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

*Effects*: Reads characters starting at s until it has extracted the (perhaps abbreviated) name of a weekday or month[.](#locale.time.get.virtuals-7.sentence-1)

If it finds an abbreviation
that is followed by characters that can match a full name,
it continues reading until it matches the full name or fails[.](#locale.time.get.virtuals-7.sentence-2)

It sets the appropriate tm member accordingly[.](#locale.time.get.virtuals-7.sentence-3)

[8](#locale.time.get.virtuals-8)

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

*Returns*: An iterator pointing immediately beyond the last character recognized
as part of a valid name[.](#locale.time.get.virtuals-8.sentence-1)

[ð](#lib:time_get,do_get_year)

`iter_type do_get_year(iter_type s, iter_type end, ios_base& str,
                      ios_base::iostate& err, tm* t) const;
`

[9](#locale.time.get.virtuals-9)

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

*Effects*: Reads characters starting at s until it has extracted an unambiguous year identifier[.](#locale.time.get.virtuals-9.sentence-1)

It isimplementation-defined
whether two-digit year numbers are accepted,
and (if so) what century they are assumed to lie in[.](#locale.time.get.virtuals-9.sentence-2)

Sets the t->tm_year member accordingly[.](#locale.time.get.virtuals-9.sentence-3)

[10](#locale.time.get.virtuals-10)

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

*Returns*: An iterator pointing immediately beyond
the last character recognized as part of a valid year identifier[.](#locale.time.get.virtuals-10.sentence-1)

[ð](#lib:do_get,time_get)

`iter_type do_get(iter_type s, iter_type end, ios_base& f,
                 ios_base::iostate& err, tm* t, char format, char modifier) const;
`

[11](#locale.time.get.virtuals-11)

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

*Preconditions*: t points to an object[.](#locale.time.get.virtuals-11.sentence-1)

[12](#locale.time.get.virtuals-12)

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

*Effects*: The function starts by evaluating err = ios_base​::​goodbit[.](#locale.time.get.virtuals-12.sentence-1)

It then reads characters starting at s until it encounters an error, or
until it has extracted and assigned those tm members, and
any remaining format characters,
corresponding to a conversion specification appropriate for
the POSIX function strptime,
formed by concatenating '%',
the modifier character, when non-NUL, and
the format character[.](#locale.time.get.virtuals-12.sentence-2)

When the concatenation fails to yield a complete valid directive
the function leaves the object pointed to by t unchanged and
evaluates err |= ios_base​::​failbit[.](#locale.time.get.virtuals-12.sentence-3)

When s == end evaluates to true after reading a character
the function evaluates err |= ios_base​::​eofbit[.](#locale.time.get.virtuals-12.sentence-4)

[13](#locale.time.get.virtuals-13)

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

For complex conversion specifications
such as %c, %x, or %X, or
conversion specifications that involve the optional modifiers E or O,
when the function is unable to unambiguously determine
some or all tm members from the input sequence [s, end),
it evaluates err |= ios_base​::​eofbit[.](#locale.time.get.virtuals-13.sentence-1)

In such cases the values of those tm members are unspecified
and may be outside their valid range[.](#locale.time.get.virtuals-13.sentence-2)

[14](#locale.time.get.virtuals-14)

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

*Returns*: An iterator pointing immediately beyond
the last character recognized as possibly part of
a valid input sequence for the given format and modifier[.](#locale.time.get.virtuals-14.sentence-1)

[15](#locale.time.get.virtuals-15)

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

*Remarks*: It is unspecified whether multiple calls to do_get() with the address of the same tm object
will update the current contents of the object or simply overwrite its members[.](#locale.time.get.virtuals-15.sentence-1)

Portable programs should zero out the object before invoking the function[.](#locale.time.get.virtuals-15.sentence-2)

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

This function is intended as a convenience only, for common formats, and
can return no_order in valid locales[.](#footnote-228.sentence-1)

#### [28.3.4.6.3](#locale.time.get.byname) Class template time_get_byname [[locale.time.get.byname]](locale.time.get.byname)

[ð](#lib:time_get_byname)

namespace std {template<class charT, class InputIterator = istreambuf_iterator<charT>>class time_get_byname : public time_get<charT, InputIterator> {public:using dateorder = time_base::dateorder; using iter_type = InputIterator; explicit time_get_byname(const char*, size_t refs = 0); explicit time_get_byname(const string&, size_t refs = 0); protected:~time_get_byname(); };}

#### [28.3.4.6.4](#locale.time.put) Class template time_put [[locale.time.put]](locale.time.put)

#### [28.3.4.6.4.1](#locale.time.put.general) General [[locale.time.put.general]](locale.time.put.general)

[ð](#lib:time_put)

namespace std {template<class charT, class OutputIterator = ostreambuf_iterator<charT>>class time_put : public locale::facet {public:using char_type = charT; using iter_type = OutputIterator; explicit time_put(size_t refs = 0); // the following is implemented in terms of other member functions. iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb, const charT* pattern, const charT* pat_end) const;
 iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb, char format, char modifier = 0) const; static locale::id id; protected:~time_put(); virtual iter_type do_put(iter_type s, ios_base&, char_type, const tm* t, char format, char modifier) const; };}

#### [28.3.4.6.4.2](#locale.time.put.members) Members [[locale.time.put.members]](locale.time.put.members)

[ð](#lib:time_put,put)

`iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
              const charT* pattern, const charT* pat_end) const;
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
              char format, char modifier = 0) const;
`

[1](#locale.time.put.members-1)

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

*Effects*: The first form steps through the sequence
from pattern to pat_end,
identifying characters that are part of a format sequence[.](#locale.time.put.members-1.sentence-1)

Each character that is not part of a format sequence
is written to s immediately, and
each format sequence, as it is identified, results in a call to do_put;
thus, format elements and other characters are interleaved in the output
in the order in which they appear in the pattern[.](#locale.time.put.members-1.sentence-2)

Format sequences are identified by converting each character c to
a char value as if by ct.narrow(c, 0),
where ct is a reference to ctype<charT> obtained from str.getloc()[.](#locale.time.put.members-1.sentence-3)

The first character of each sequence is equal to '%',
followed by an optional modifier character mod and a format specifier character spec as defined for the function strftime[.](#locale.time.put.members-1.sentence-4)

If no modifier character is present, mod is zero[.](#locale.time.put.members-1.sentence-5)

For each valid format sequence identified,
calls do_put(s, str, fill, t, spec, mod)[.](#locale.time.put.members-1.sentence-6)

[2](#locale.time.put.members-2)

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

The second form calls do_put(s, str, fill, t, format, modifier)[.](#locale.time.put.members-2.sentence-1)

[3](#locale.time.put.members-3)

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

[*Note [1](#locale.time.put.members-note-1)*:

The fill argument can be used
in the implementation-defined formats or by derivations[.](#locale.time.put.members-3.sentence-1)

A space character is a reasonable default for this argument[.](#locale.time.put.members-3.sentence-2)

â *end note*]

[4](#locale.time.put.members-4)

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

*Returns*: An iterator pointing immediately after the last character produced[.](#locale.time.put.members-4.sentence-1)

#### [28.3.4.6.4.3](#locale.time.put.virtuals) Virtual functions [[locale.time.put.virtuals]](locale.time.put.virtuals)

[ð](#lib:time_put,do_put)

`iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
                 char format, char modifier) const;
`

[1](#locale.time.put.virtuals-1)

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

*Effects*: Formats the contents of the parameter t into characters placed on the output sequence s[.](#locale.time.put.virtuals-1.sentence-1)

Formatting is controlled by the parameters format and modifier,
interpreted identically as the format specifiers
in the string argument to the standard library functionstrftime(),
except that the sequence of characters produced for those specifiers
that are described as depending on the C locale
are insteadimplementation-defined[.](#locale.time.put.virtuals-1.sentence-2)

[*Note [1](#locale.time.put.virtuals-note-1)*:

Interpretation of the modifier argument is implementation-defined[.](#locale.time.put.virtuals-1.sentence-3)

â *end note*]

[2](#locale.time.put.virtuals-2)

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

*Returns*: An iterator pointing immediately after the last character produced[.](#locale.time.put.virtuals-2.sentence-1)

[*Note [2](#locale.time.put.virtuals-note-2)*:

The fill argument can be used
in the implementation-defined formats or by derivations[.](#locale.time.put.virtuals-2.sentence-2)

A space character is a reasonable default for this argument[.](#locale.time.put.virtuals-2.sentence-3)

â *end note*]

[3](#locale.time.put.virtuals-3)

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

*Recommended practice*: Interpretation of the modifier should follow POSIX conventions[.](#locale.time.put.virtuals-3.sentence-1)

Implementations should refer to other standards such as POSIX
for a specification of the character sequences produced for
those specifiers described as depending on the C locale[.](#locale.time.put.virtuals-3.sentence-2)

#### [28.3.4.6.5](#locale.time.put.byname) Class template time_put_byname [[locale.time.put.byname]](locale.time.put.byname)

[ð](#lib:time_put_byname)

namespace std {template<class charT, class OutputIterator = ostreambuf_iterator<charT>>class time_put_byname : public time_put<charT, OutputIterator> {public:using char_type = charT; using iter_type = OutputIterator; explicit time_put_byname(const char*, size_t refs = 0); explicit time_put_byname(const string&, size_t refs = 0); protected:~time_put_byname(); };}

#### [28.3.4.7](#category.monetary) The monetary category [[category.monetary]](category.monetary)

#### [28.3.4.7.1](#category.monetary.general) General [[category.monetary.general]](category.monetary.general)

[1](#category.monetary.general-1)

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

These templates handle monetary formats[.](#category.monetary.general-1.sentence-1)

A template parameter indicates
whether local or international monetary formats are to be used[.](#category.monetary.general-1.sentence-2)

[2](#category.monetary.general-2)

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

All specifications of member functions
for money_put and money_get in the subclauses of [[category.monetary]](#category.monetary "28.3.4.7 The monetary category") only apply to
the specializations required in Tables [91](locale.category#tab:locale.category.facets "Table 91: Locale category facets") and [92](locale.category#tab:locale.spec "Table 92: Required specializations") ([[locale.category]](locale.category "28.3.3.1.2.1 Type locale​::​category"))[.](#category.monetary.general-2.sentence-1)

Their members use their ios_base&, ios_base​::​iostate&,
and fill arguments as described in [locale.categories], and
the moneypunct<> and ctype<> facets,
to determine formatting details[.](#category.monetary.general-2.sentence-2)

#### [28.3.4.7.2](#locale.money.get) Class template money_get [[locale.money.get]](locale.money.get)

#### [28.3.4.7.2.1](#locale.money.get.general) General [[locale.money.get.general]](locale.money.get.general)

[ð](#lib:money_get)

namespace std {template<class charT, class InputIterator = istreambuf_iterator<charT>>class money_get : public locale::facet {public:using char_type = charT; using iter_type = InputIterator; using string_type = basic_string<charT>; explicit money_get(size_t refs = 0);

 iter_type get(iter_type s, iter_type end, bool intl,
 ios_base& f, ios_base::iostate& err, long double& units) const;
 iter_type get(iter_type s, iter_type end, bool intl,
 ios_base& f, ios_base::iostate& err,
 string_type& digits) const; static locale::id id; protected:~money_get(); virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
 ios_base::iostate& err, long double& units) const; virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
 ios_base::iostate& err, string_type& digits) const; };}

#### [28.3.4.7.2.2](#locale.money.get.members) Members [[locale.money.get.members]](locale.money.get.members)

[ð](#lib:money_get,get)

`iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
              ios_base::iostate& err, long double& quant) const;
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
              ios_base::iostate& err, string_type& quant) const;
`

[1](#locale.money.get.members-1)

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

*Returns*: do_get(s, end, intl, f, err, quant)[.](#locale.money.get.members-1.sentence-1)

#### [28.3.4.7.2.3](#locale.money.get.virtuals) Virtual functions [[locale.money.get.virtuals]](locale.money.get.virtuals)

[ð](#lib:money_get,do_get)

`iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
                 ios_base::iostate& err, long double& units) const;
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
                 ios_base::iostate& err, string_type& digits) const;
`

[1](#locale.money.get.virtuals-1)

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

*Effects*: Reads characters from s to parse and construct a monetary value
according to the format specified by
a moneypunct<charT, Intl> facet reference mp and the character mapping specified by
a ctype<charT> facet reference ct obtained from the locale returned by str.getloc(), andstr.flags()[.](#locale.money.get.virtuals-1.sentence-1)

If a valid sequence is recognized, does not change err;
otherwise, sets err to (err | str.failbit), or(err | str.failbit | str.eofbit) if no more characters are available,
and does not change units or digits[.](#locale.money.get.virtuals-1.sentence-2)

Uses the pattern returned by mp.neg_format() to parse all values[.](#locale.money.get.virtuals-1.sentence-3)

The result is returned as an integral value stored in units or as a sequence of digits possibly preceded by a minus sign
(as produced by ct.widen(c) where c is '-' or
in the range from '0' through '9' (inclusive))
stored in digits[.](#locale.money.get.virtuals-1.sentence-4)

[*Example [1](#locale.money.get.virtuals-example-1)*:

The sequence $1,056.23 in a common United States locale would yield,
for units, 105623, or,
for digits, "105623"[.](#locale.money.get.virtuals-1.sentence-5)

â *end example*]

If mp.grouping() indicates that no thousands separators are permitted,
any such characters are not read, and
parsing is terminated at the point where they first appear[.](#locale.money.get.virtuals-1.sentence-6)

Otherwise, thousands separators are optional;
if present, they are checked for correct placement only after
all format components have been read[.](#locale.money.get.virtuals-1.sentence-7)

[2](#locale.money.get.virtuals-2)

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

Where money_base​::​space or money_base​::​none appears as the last element in the format pattern,
no whitespace is consumed[.](#locale.money.get.virtuals-2.sentence-1)

Otherwise, where money_base​::​space appears in any of
the initial elements of the format pattern,
at least one whitespace character is required[.](#locale.money.get.virtuals-2.sentence-2)

Where money_base​::​none appears
in any of the initial elements of the format pattern,
whitespace is allowed but not required[.](#locale.money.get.virtuals-2.sentence-3)

If (str.flags() & str.showbase) is false,
the currency symbol is optional and
is consumed only if other characters are needed to complete the format;
otherwise, the currency symbol is required[.](#locale.money.get.virtuals-2.sentence-4)

[3](#locale.money.get.virtuals-3)

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

If the first character (if any) in
the string pos returned by mp.positive_sign() or
the string neg returned by mp.negative_sign() is recognized in the position indicated by sign in the format pattern,
it is consumed and
any remaining characters in the string are required
after all the other format components[.](#locale.money.get.virtuals-3.sentence-1)

[*Example [2](#locale.money.get.virtuals-example-2)*:

If showbase is off,
then for a neg value of "()" and
a currency symbol of "L",
in "(100 L)" the "L" is consumed;
but if neg is "-",
the "L" in "-100 L" is not consumed[.](#locale.money.get.virtuals-3.sentence-2)

â *end example*]

If pos or neg is empty,
the sign component is optional, and
if no sign is detected,
the result is given the sign that corresponds to the source of the empty string[.](#locale.money.get.virtuals-3.sentence-3)

Otherwise,
the character in the indicated position must match
the first character of pos or neg,
and the result is given the corresponding sign[.](#locale.money.get.virtuals-3.sentence-4)

If the first character of pos is equal to
the first character of neg,
or if both strings are empty,
the result is given a positive sign[.](#locale.money.get.virtuals-3.sentence-5)

[4](#locale.money.get.virtuals-4)

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

Digits in the numeric monetary component are extracted and
placed in digits, or into a character buffer buf1 for conversion to produce a value for units,
in the order in which they appear,
preceded by a minus sign if and only if the result is negative[.](#locale.money.get.virtuals-4.sentence-1)

The value units is produced as if by[229](#footnote-229 "The semantics here are different from ct.narrow.")for (int i = 0; i < n; ++i) buf2[i] = src[find(atoms, atoms + sizeof(src), buf1[i]) - atoms];
buf2[n] = 0;
sscanf(buf2, "%Lf", &units); where n is the number of characters placed in buf1,buf2 is a character buffer, and
the values src and atoms are defined as if bystatic const char src[] = "0123456789-";
charT atoms[sizeof(src)];
ct.widen(src, src + sizeof(src) - 1, atoms);

[5](#locale.money.get.virtuals-5)

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

*Returns*: An iterator pointing immediately beyond
the last character recognized as part of a valid monetary quantity[.](#locale.money.get.virtuals-5.sentence-1)

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

The semantics here are different from ct.narrow[.](#footnote-229.sentence-1)

#### [28.3.4.7.3](#locale.money.put) Class template money_put [[locale.money.put]](locale.money.put)

#### [28.3.4.7.3.1](#locale.money.put.general) General [[locale.money.put.general]](locale.money.put.general)

[ð](#lib:money_put)

namespace std {template<class charT, class OutputIterator = ostreambuf_iterator<charT>>class money_put : public locale::facet {public:using char_type = charT; using iter_type = OutputIterator; using string_type = basic_string<charT>; explicit money_put(size_t refs = 0);

 iter_type put(iter_type s, bool intl, ios_base& f,
 char_type fill, long double units) const;
 iter_type put(iter_type s, bool intl, ios_base& f,
 char_type fill, const string_type& digits) const; static locale::id id; protected:~money_put(); virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill, long double units) const; virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill, const string_type& digits) const; };}

#### [28.3.4.7.3.2](#locale.money.put.members) Members [[locale.money.put.members]](locale.money.put.members)

[ð](#lib:money_put,put)

`iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
`

[1](#locale.money.put.members-1)

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

*Returns*: do_put(s, intl, f, fill, quant)[.](#locale.money.put.members-1.sentence-1)

#### [28.3.4.7.3.3](#locale.money.put.virtuals) Virtual functions [[locale.money.put.virtuals]](locale.money.put.virtuals)

[ð](#lib:money_put,do_put)

`iter_type do_put(iter_type s, bool intl, ios_base& str,
                 char_type fill, long double units) const;
iter_type do_put(iter_type s, bool intl, ios_base& str,
                 char_type fill, const string_type& digits) const;
`

[1](#locale.money.put.virtuals-1)

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

*Effects*: Writes characters to s according to
the format specified by
a moneypunct<charT, Intl> facet reference mp and
the character mapping specified by
a ctype<charT> facet reference ct obtained from the locale returned by str.getloc(),
and str.flags()[.](#locale.money.put.virtuals-1.sentence-1)

The argument units is transformed into
a sequence of wide characters as if byct.widen(buf1, buf1 + sprintf(buf1, "%.0Lf", units), buf2) for character buffers buf1 and buf2[.](#locale.money.put.virtuals-1.sentence-2)

If the first character in digits or buf2 is equal to ct.widen('-'),
then the pattern used for formatting is the result of mp.neg_format();
otherwise the pattern is the result of mp.pos_format()[.](#locale.money.put.virtuals-1.sentence-3)

Digit characters are written,
interspersed with any thousands separators and decimal point
specified by the format,
in the order they appear (after the optional leading minus sign) indigits or buf2[.](#locale.money.put.virtuals-1.sentence-4)

In digits,
only the optional leading minus sign and
the immediately subsequent digit characters
(as classified according to ct)
are used;
any trailing characters
(including digits appearing after a non-digit character)
are ignored[.](#locale.money.put.virtuals-1.sentence-5)

Calls str.width(0)[.](#locale.money.put.virtuals-1.sentence-6)

[2](#locale.money.put.virtuals-2)

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

*Returns*: An iterator pointing immediately after the last character produced[.](#locale.money.put.virtuals-2.sentence-1)

[3](#locale.money.put.virtuals-3)

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

*Remarks*: The currency symbol is generated
if and only if (str.flags() & str.showbase) is nonzero[.](#locale.money.put.virtuals-3.sentence-1)

If the number of characters generated for the specified format
is less than the value returned by str.width() on entry to the function,
then copies of fill are inserted as necessary
to pad to the specified width[.](#locale.money.put.virtuals-3.sentence-2)

For the value af equal to (str.flags() & str.adjustfield),
if (af == str.internal) is true,
the fill characters are placed
where none or space appears in the formatting pattern;
otherwise if (af == str.left) is true,
they are placed after the other characters;
otherwise, they are placed before the other characters[.](#locale.money.put.virtuals-3.sentence-3)

[*Note [1](#locale.money.put.virtuals-note-1)*:

It is possible, with some combinations of format patterns and flag values,
to produce output that cannot be parsed using num_get<>​::​get[.](#locale.money.put.virtuals-3.sentence-4)

â *end note*]

#### [28.3.4.7.4](#locale.moneypunct) Class template moneypunct [[locale.moneypunct]](locale.moneypunct)

#### [28.3.4.7.4.1](#locale.moneypunct.general) General [[locale.moneypunct.general]](locale.moneypunct.general)

[ð](#lib:moneypunct)

namespace std {class money_base {public:enum part { none, space, symbol, sign, value }; struct pattern { char field[4]; }; }; template<class charT, bool International = false>class moneypunct : public locale::facet, public money_base {public:using char_type = charT; using string_type = basic_string<charT>; explicit moneypunct(size_t refs = 0);

 charT decimal_point() const;
 charT thousands_sep() const;
 string grouping() const;
 string_type curr_symbol() const;
 string_type positive_sign() const;
 string_type negative_sign() const; int frac_digits() const;
 pattern pos_format() const;
 pattern neg_format() const; static locale::id id; static const bool intl = International; protected:~moneypunct(); virtual charT do_decimal_point() const; virtual charT do_thousands_sep() const; virtual string do_grouping() const; virtual string_type do_curr_symbol() const; virtual string_type do_positive_sign() const; virtual string_type do_negative_sign() const; virtual int do_frac_digits() const; virtual pattern do_pos_format() const; virtual pattern do_neg_format() const; };}

[1](#locale.moneypunct.general-1)

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

The moneypunct<> facet defines monetary formatting parameters
used by money_get<> and money_put<>[.](#locale.moneypunct.general-1.sentence-1)

A monetary format is a sequence of four components,
specified by a pattern value p,
such that the part value static_cast<part>(p.field[i]) determines the ith component of the format[.](#locale.moneypunct.general-1.sentence-2)[230](#footnote-230 "An array of char, rather than an array of part, is specified for pattern​::​field purely for efficiency.")

In the field member of a pattern object,
each value symbol, sign, value, and
either space or none appears exactly once[.](#locale.moneypunct.general-1.sentence-3)

The value none, if present, is not first;
the value space, if present, is neither first nor last[.](#locale.moneypunct.general-1.sentence-4)

[2](#locale.moneypunct.general-2)

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

Where none or space appears,
whitespace is permitted in the format,
except where none appears at the end,
in which case no whitespace is permitted[.](#locale.moneypunct.general-2.sentence-1)

The value space indicates that
at least one space is required at that position[.](#locale.moneypunct.general-2.sentence-2)

Where symbol appears,
the sequence of characters returned by curr_symbol() is permitted, and
can be required[.](#locale.moneypunct.general-2.sentence-3)

Where sign appears,
the first (if any) of the sequence of characters returned bypositive_sign() or negative_sign() (respectively as the monetary value is non-negative or negative) is required[.](#locale.moneypunct.general-2.sentence-4)

Any remaining characters of the sign sequence are required after
all other format components[.](#locale.moneypunct.general-2.sentence-5)

Where value appears, the absolute numeric monetary value is required[.](#locale.moneypunct.general-2.sentence-6)

[3](#locale.moneypunct.general-3)

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

The format of the numeric monetary value is a decimal number:

value :  
units fractionalopt  
decimal-point digits

fractional :  
decimal-point digitsopt

if frac_digits() returns a positive value, or

value :  
units

otherwise[.](#locale.moneypunct.general-3.sentence-1)

The symbol *decimal-point* indicates the character returned by decimal_point()[.](#locale.moneypunct.general-3.sentence-2)

The other symbols are defined as follows:

units :  
digits  
digits thousands-sep units

digits :  
adigit digitsopt

In the syntax specification,
the symbol *adigit* is any of the values ct.widen(c) for c in the range '0' through '9' (inclusive) andct is a reference of type const ctype<charT>& obtained as described in the definitions
of money_get<> and money_put<>[.](#locale.moneypunct.general-3.sentence-4)

The symbol *thousands-sep* is the character returned by thousands_sep()[.](#locale.moneypunct.general-3.sentence-5)

The space character used is the value ct.widen(' ')[.](#locale.moneypunct.general-3.sentence-6)

Whitespace characters are those characters c for which ci.is(space, c) returns true[.](#locale.moneypunct.general-3.sentence-7)

The number of digits required after the decimal point (if any)
is exactly the value returned by frac_digits()[.](#locale.moneypunct.general-3.sentence-8)

[4](#locale.moneypunct.general-4)

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

The placement of thousands-separator characters (if any)
is determined by the value returned by grouping(),
defined identically as the member numpunct<>​::​do_grouping()[.](#locale.moneypunct.general-4.sentence-1)

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

An array of char,
rather than an array of part,
is specified for pattern​::​field purely for efficiency[.](#footnote-230.sentence-1)

#### [28.3.4.7.4.2](#locale.moneypunct.members) Members [[locale.moneypunct.members]](locale.moneypunct.members)

[ð](#lib:moneypunct,decimal_point)

charT decimal_point() const;
charT thousands_sep() const;
string grouping() const;
string_type curr_symbol() const;
string_type positive_sign() const;
string_type negative_sign() const;int frac_digits() const;
pattern pos_format() const;
pattern neg_format() const;

[1](#locale.moneypunct.members-1)

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

Each of these functions *F* returns the result of calling the corresponding
virtual member functiondo_*F*()[.](#locale.moneypunct.members-1.sentence-1)

#### [28.3.4.7.4.3](#locale.moneypunct.virtuals) Virtual functions [[locale.moneypunct.virtuals]](locale.moneypunct.virtuals)

[ð](#lib:moneypunct,do_decimal_point)

`charT do_decimal_point() const;
`

[1](#locale.moneypunct.virtuals-1)

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

*Returns*: The radix separator to use
in case do_frac_digits() is greater than zero[.](#locale.moneypunct.virtuals-1.sentence-1)[231](#footnote-231 "In common U.S. locales this is '.'.")

[ð](#lib:moneypunct,do_thousands_sep)

`charT do_thousands_sep() const;
`

[2](#locale.moneypunct.virtuals-2)

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

*Returns*: The digit group separator to use
in case do_grouping() specifies a digit grouping pattern[.](#locale.moneypunct.virtuals-2.sentence-1)[232](#footnote-232 "In common U.S. locales this is ','.")

[ð](#lib:moneypunct,do_grouping)

`string do_grouping() const;
`

[3](#locale.moneypunct.virtuals-3)

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

*Returns*: A pattern defined identically as, but not necessarily equal to,
the result of numpunct<charT>​::​​do_grouping()[.](#locale.moneypunct.virtuals-3.sentence-1)[233](#footnote-233 "To specify grouping by 3s, the value is &quot;\003&quot; not &quot;3&quot;.")

[ð](#lib:moneypunct,do_curr_symbol)

`string_type do_curr_symbol() const;
`

[4](#locale.moneypunct.virtuals-4)

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

*Returns*: A string to use as the currency identifier symbol[.](#locale.moneypunct.virtuals-4.sentence-1)

[*Note [1](#locale.moneypunct.virtuals-note-1)*:

For specializations where the second template parameter is true,
this is typically four characters long:
a three-letter code as specified by ISO 4217[[bib]](bibliography#bib:iso4217 "Bibliography") followed by a space[.](#locale.moneypunct.virtuals-4.sentence-2)

â *end note*]

[ð](#lib:moneypunct,do_positive_sign)

`string_type do_positive_sign() const;
string_type do_negative_sign() const;
`

[5](#locale.moneypunct.virtuals-5)

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

*Returns*: do_positive_sign() returns the string to use to indicate a positive monetary value;[234](#footnote-234 "This is usually the empty string.")do_negative_sign() returns the string to use to indicate a negative value[.](#locale.moneypunct.virtuals-5.sentence-1)

[ð](#lib:moneypunct,do_frac_digits)

`int do_frac_digits() const;
`

[6](#locale.moneypunct.virtuals-6)

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

*Returns*: The number of digits after the decimal radix separator, if any[.](#locale.moneypunct.virtuals-6.sentence-1)[235](#footnote-235 "In common U.S.&nbsp;locales, this is 2.")

[ð](#lib:moneypunct,do_pos_format)

`pattern do_pos_format() const;
pattern do_neg_format() const;
`

[7](#locale.moneypunct.virtuals-7)

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

*Returns*: The specializations required in Table [92](locale.category#tab:locale.spec "Table 92: Required specializations") ([[locale.category]](locale.category "28.3.3.1.2.1 Type locale​::​category")), namely

- [(7.1)](#locale.moneypunct.virtuals-7.1)

moneypunct<char>,

- [(7.2)](#locale.moneypunct.virtuals-7.2)

moneypunct<wchar_t>,

- [(7.3)](#locale.moneypunct.virtuals-7.3)

moneypunct<char, true>, and

- [(7.4)](#locale.moneypunct.virtuals-7.4)

moneypunct<wchar_t, true>,

return an object of type pattern initialized to { symbol, sign, none, value }[.](#locale.moneypunct.virtuals-7.sentence-1)[236](#footnote-236 "Note that the international symbol returned by do_­curr_­symbol() usually contains a space, itself; for example, &quot;USD &quot;.")

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

In common U.S. locales this is '.'[.](#footnote-231.sentence-1)

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

In common U.S. locales this is ','[.](#footnote-232.sentence-1)

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

To specify grouping by 3s,
the value is "\003" *not* "3"[.](#footnote-233.sentence-1)

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

This is usually the empty string[.](#footnote-234.sentence-1)

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

In common U.S. locales, this is 2[.](#footnote-235.sentence-1)

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

Note that the international symbol returned by do_curr_symbol() usually contains a space, itself;
for example, "USD "[.](#footnote-236.sentence-1)

#### [28.3.4.7.5](#locale.moneypunct.byname) Class template moneypunct_byname [[locale.moneypunct.byname]](locale.moneypunct.byname)

[ð](#lib:moneypunct_byname)

namespace std {template<class charT, bool Intl = false>class moneypunct_byname : public moneypunct<charT, Intl> {public:using pattern = money_base::pattern; using string_type = basic_string<charT>; explicit moneypunct_byname(const char*, size_t refs = 0); explicit moneypunct_byname(const string&, size_t refs = 0); protected:~moneypunct_byname(); };}

#### [28.3.4.8](#category.messages) The message retrieval category [[category.messages]](category.messages)

#### [28.3.4.8.1](#category.messages.general) General [[category.messages.general]](category.messages.general)

[1](#category.messages.general-1)

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

Class messages<charT> implements retrieval of strings from message catalogs[.](#category.messages.general-1.sentence-1)

#### [28.3.4.8.2](#locale.messages) Class template messages [[locale.messages]](locale.messages)

#### [28.3.4.8.2.1](#locale.messages.general) General [[locale.messages.general]](locale.messages.general)

[ð](#lib:messages)

namespace std {class messages_base {public:using catalog = *unspecified signed integer type*; }; template<class charT>class messages : public locale::facet, public messages_base {public:using char_type = charT; using string_type = basic_string<charT>; explicit messages(size_t refs = 0);

 catalog open(const string& fn, const locale&) const;
 string_type get(catalog c, int set, int msgid, const string_type& dfault) const; void close(catalog c) const; static locale::id id; protected:~messages(); virtual catalog do_open(const string&, const locale&) const; virtual string_type do_get(catalog, int set, int msgid, const string_type& dfault) const; virtual void do_close(catalog) const; };}

[1](#locale.messages.general-1)

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

Values of type messages_base​::​catalog usable as arguments to members get and close can be obtained only by calling member open[.](#locale.messages.general-1.sentence-1)

#### [28.3.4.8.2.2](#locale.messages.members) Members [[locale.messages.members]](locale.messages.members)

[ð](#lib:messages,open)

`catalog open(const string& name, const locale& loc) const;
`

[1](#locale.messages.members-1)

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

*Returns*: do_open(name, loc)[.](#locale.messages.members-1.sentence-1)

[ð](#lib:messages,get)

`string_type get(catalog cat, int set, int msgid, const string_type& dfault) const;
`

[2](#locale.messages.members-2)

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

*Returns*: do_get(cat, set, msgid, dfault)[.](#locale.messages.members-2.sentence-1)

[ð](#lib:messages,close)

`void close(catalog cat) const;
`

[3](#locale.messages.members-3)

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

*Effects*: Calls do_close(cat)[.](#locale.messages.members-3.sentence-1)

#### [28.3.4.8.2.3](#locale.messages.virtuals) Virtual functions [[locale.messages.virtuals]](locale.messages.virtuals)

[ð](#lib:messages,do_open)

`catalog do_open(const string& name, const locale& loc) const;
`

[1](#locale.messages.virtuals-1)

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

*Returns*: A value that may be passed to get() to retrieve a message from the message catalog
identified by the string name according to an implementation-defined mapping[.](#locale.messages.virtuals-1.sentence-1)

The result can be used until it is passed to close()[.](#locale.messages.virtuals-1.sentence-2)

[2](#locale.messages.virtuals-2)

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

Returns a value less than 0 if no such catalog can be opened[.](#locale.messages.virtuals-2.sentence-1)

[3](#locale.messages.virtuals-3)

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

*Remarks*: The locale argument loc is used for
character set code conversion when retrieving messages, if needed[.](#locale.messages.virtuals-3.sentence-1)

[ð](#lib:messages,do_get)

`string_type do_get(catalog cat, int set, int msgid, const string_type& dfault) const;
`

[4](#locale.messages.virtuals-4)

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

*Preconditions*: cat is a catalog obtained from open() and not yet closed[.](#locale.messages.virtuals-4.sentence-1)

[5](#locale.messages.virtuals-5)

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

*Returns*: A message identified by
arguments set, msgid, and dfault,
according to
an implementation-defined mapping[.](#locale.messages.virtuals-5.sentence-1)

If no such message can be found, returns dfault[.](#locale.messages.virtuals-5.sentence-2)

[ð](#lib:message,do_close)

`void do_close(catalog cat) const;
`

[6](#locale.messages.virtuals-6)

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

*Preconditions*: cat is a catalog obtained from open() and not yet closed[.](#locale.messages.virtuals-6.sentence-1)

[7](#locale.messages.virtuals-7)

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

*Effects*: Releases unspecified resources associated with cat[.](#locale.messages.virtuals-7.sentence-1)

[8](#locale.messages.virtuals-8)

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

*Remarks*: The limit on such resources, if any, isimplementation-defined[.](#locale.messages.virtuals-8.sentence-1)

#### [28.3.4.8.3](#locale.messages.byname) Class template messages_byname [[locale.messages.byname]](locale.messages.byname)

[ð](#lib:messages_byname)

namespace std {template<class charT>class messages_byname : public messages<charT> {public:using catalog = messages_base::catalog; using string_type = basic_string<charT>; explicit messages_byname(const char*, size_t refs = 0); explicit messages_byname(const string&, size_t refs = 0); protected:~messages_byname(); };}
