std::numpunct (3) - Linux Manuals
std::numpunct: std::numpunct
NAME
Synopsis
Defined in header <locale>
template< class CharT >
class numpunct;
The facet std::numpunct encapsulates numeric punctuation preferences. Stream I/O operations use std::numpunct through std::num_get and std::num_put for parsing numeric input and formatting numeric output.
The numbers that are supported by std::numpunct have the format described below. Here digit represents the radix set specified by the fmtflags argument value, thousands-sep and decimal-point are the results of thousands_sep() and decimal_point() functions respectively. The format of integer values is as follows:
The number of digits between the thousand-seps (maximum size of digits) is specified by the result of grouping().
The format of floating-point values is as follows:
std-numpunct-inheritance.svg
Inheritance diagram
Two standalone (locale-independent) specializations are provided by the standard library:
Defined in header <locale>
std::numpunct<char> provides equivalents of the "C" locale preferences
std::numpunct<wchar_t> provides wide character equivalents of the "C" locale preferences
In addition, every locale object constructed in a C++ program implements its own (locale-specific) versions of these specializations.
Member types
Member type Definition
char_type charT
string_type std::basic_string<charT>
Member functions
constructor (public member function)
destructor (protected member function)
decimal_point (public member function)
thousands_sep (public member function)
grouping (public member function)
truename (public member function)
falsename
Protected member functions
do_decimal_point provides the character to use as decimal point
[virtual]
do_thousands_sep provides the character to use as thousands separator
[virtual]
do_grouping provides the numbers of digits between each pair of thousands separators
[virtual]
do_truename provides the string to use as the name of the boolean true and false
do_falsename (virtual protected member function)
[virtual]
Member objects
static std::locale::id id (public member object)
Example
The following example changes the string representations of true and false
// Run this code
Output:
See also