std::numpunct
From cppreference.com
                    
                                        
                    
                    
                                                            
                    |   Defined in header <locale>
   | 
||
|   template< class charT > class numpunct : public std::locale::facet;  | 
||
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.
Two 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 | 
Contents | 
[edit] Member types
| Member type | Definition | 
| char_type | charT | 
| string_type | std::basic_string<charT> | 
[edit] Member objects
| Member name | Type | 
| id (static) | std::locale::id | 
[edit] Member functions
|   constructs a new numpunct facet  (public member function)  | |
|   destructs a numpunct facet  (protected member function)  | |
|   | |
|    invokes do_decimal_point   (public member function)  | |
|    invokes do_thousands_sep   (public member function)  | |
|    invokes do_grouping    (public member function)  | |
|    invokes do_truename   (public member function)  | |
|    invokes do_falsename    (public member function)  | |
[edit] Protected member functions
|    [virtual]  | 
   provides the character to use as decimal point    (virtual protected member function)  | 
|    [virtual]  | 
   provides the character to use as thousands separator   (virtual protected member function)  | 
|    [virtual]  | 
   provides the numbers of digits between each pair of thousands
 separators    | 
|    [virtual]  | 
   provides the string to use as the name of the boolean true   (virtual protected member function)  | 
|    [virtual]  | 
   provides the string to use as the name of the boolean false   (virtual protected member function)  | 
[edit] Example
The following example changes the string representations of true and false
#include <iostream> #include <locale> struct french_bool : std::numpunct<char> { string_type do_truename() const { return "oui"; } string_type do_falsename() const { return "non"; } }; int main() { std::cout << "default locale: " << std::boolalpha << true << ", " << false << '\n'; std::cout.imbue(std::locale(std::cout.getloc(), new french_bool())); std::cout << "locale with modified numpunct: " << std::boolalpha << true << ", " << false << '\n'; }
Output:
default locale: true, false locale with modified numpunct: oui, non
[edit] See also
|    creates a numpunct facet for the named locale   (class template)  | |