| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
numpunct::decimal_pointnumpunct::do_decimal_point | ||||
Defined in header <locale> | ||
public: char_type decimal_point()const; | (1) | |
protected: virtual char_type do_decimal_point()const; | (2) | |
do_decimal_point of the most derived class.The value of typechar_type to use as the decimal separator. The standard specializations ofstd::numpunct return'.' andL'.'.
#include <iostream>#include <locale> struct slash:std::numpunct<char>{char do_decimal_point()const{return'/';}// separate with slash}; int main(){std::cout.precision(10);std::cout<<"default locale: "<<1234.5678<<'\n';std::cout.imbue(std::locale(std::cout.getloc(), new slash));std::cout<<"locale with modified numpunct: "<<1234.5678<<'\n';}
Output:
default locale: 1234.5678locale with modified numpunct: 1234/5678