std::numpunct_byname
is a std::numpunct facet which encapsulates numeric punctuation preferences of a locale specified at its construction.
The standard library is guaranteed to provide the following specializations:
std::numpunct_byname<char> locale-specific std::numpunct facet for narrow character I/O std::numpunct_byname<wchar_t> locale-specific std::numpunct facet for wide character I/O [edit] Nested types [edit] Member functions constructs a newnumpunct_byname
facet
numpunct_byname
facet
Constructs a new std::numpunct_byname
facet for a locale with name.
refs is used for resource management: if refs == 0, the implementation destroys the facet, when the last std::locale object holding it is destroyed. Otherwise, the object is not destroyed.
Parameters name - the name of the locale refs - the number of references that link to the facet std::numpunct_byname::~numpunct_bynameprotected:
~numpunct_byname();
Destroys the facet.
Inherited from std::numpunct Nested types [edit] Data members Member functions invokesdo_decimal_point
std::numpunct<CharT>
) [edit] invokes do_thousands_sep
std::numpunct<CharT>
) [edit] invokes do_grouping
std::numpunct<CharT>
) [edit] invokes do_truename
or do_falsename
std::numpunct<CharT>
) [edit] Protected member functions provides the character to use as decimal point
std::numpunct<CharT>
) [edit] provides the character to use as thousands separator
std::numpunct<CharT>
) [edit] provides the numbers of digits between each pair of thousands separators
std::numpunct<CharT>
) [edit] provides the string to use as the name of the boolean true and false
std::numpunct<CharT>
) [edit] [edit] Example
This example demonstrates how to apply numeric punctuation rules of another language without changing the rest of the locale.
#include <iostream> #include <locale> int main() { const double number = 1000.25; std::wcout << L"default locale: " << number << L'\n'; std::wcout.imbue(std::locale(std::wcout.getloc(), new std::numpunct_byname<wchar_t>("ru_RU.UTF8"))); std::wcout << L"default locale with russian numpunct: " << number << L'\n'; }
Output:
default locale: 1000.25 default locale with russian numpunct: 1 000,25[edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4