class template
<locale>
std::moneypunct
template <class charT, bool International = false> class moneypunct;
Monetary punctuation facet
The moneypunct standard facet provides information about the format of monetary values.
The moneypunct class template has a protected destructor: Programs shall only construct objects of derived classes, or use those installed in locale objects (through use_facet).
All standard locale objects support at least the following facet instantiations of the moneypunct class template as part of the money category:
facets in locale objects | description |
moneypunct<char> | narrow characters |
moneypunct<wchar_t> | wide characters |
moneypunct<char,true> | narrow characters, international representation |
moneypunct<wchar_t,true> | wide characters, international representation |
Template parameters
- charT
- Character type.
This is the type of characters used to produce the representation.
Aliased as member char_type.
- International
- If
true
, the representation uses an international format (such as using the three-letter code USD
for the US dollar)
If false
(the default value), the representation may use a non-international format (such as using the dollar sign, $
, for the US dollar).
Member types
member type | definition | description |
char_type | The template parameter (charT) | Character type |
string_type | basic_string<charT> | The basic_string instantiation for characters of type charT (such as string for char ).
|
The class also inherits member types part and pattern from money_base.
Member constants
The following member constants are inherited from money_base (as labels of enum
type money_base::part); They are used as the possible values of the elements in the pattern objects returned by members moneypunct::pos_format and moneypunct::neg_format.
member constant | type | value | description |
none | money_base::part | 0 | None |
space | money_base::part | 1 | A single space character |
symbol | money_base::part | 2 | Currency symbol |
sign | money_base::part | 3 | Sign: + for positive, - for negative |
value | money_base::part | 4 | Monetary value |
The class also contains a two public static constants:
member constant | type | description |
intl | bool | Alias of the second class template argument: Internation |
id | locale::id | Value that uniquely identifies facets with moneypunct semantics |
Public member functions
- (constructor)
- moneypunct constructor (public member function)
- decimal_point
- Return decimal point character (public member function)
- thousands_sep
- Return thousands separator character (public member function)
- grouping
- Return grouping of digits (public member function)
- curr_symbol
- Return currency symbol (public member function)
- positive_sign
- Return positive sign string (public member function)
- negative_sign
- Return negative sign string (public member function)
- frac_digits
- Return fractional digits (public member function)
- pos_format
- Return format for positive monetary expressions (public member function)
- neg_format
- Return format of negative monetary expressions (public member function)
Virtual protected member functions
The class defines the virtual protected members which implement the behavior by default of their respective public member functions:
- do_decimal_point
- Return decimal point character [virtual] (protected virtual member function)
- do_thousands_sep
- Return thousands separator character [virtual] (protected virtual member function)
- do_grouping
- Return grouping of digits [virtual] (protected virtual member function)
- do_curr_symbol
- Return currency symbol [virtual] (protected virtual member function)
- do_positive_sign
- Return positive sign string [virtual] (protected virtual member function)
- do_negative_sign
- Return negative sign string [virtual] (protected virtual member function)
- do_frac_digits
- Return fractional digits [virtual] (protected virtual member function)
- do_pos_format
- Return format for positive monetary expressions [virtual] (protected virtual member function)
- do_neg_format
- Return format for negative monetary expressions [virtual] (protected virtual member function)
Along with the class destructor
- (destructor)
- moneypunct destructor (protected member function)
Specializations
At least the following specializations of this template are provided in all library implementations:
specialization |
moneypunct<char> |
moneypunct<wchar_t> |
moneypunct<char,true> |
moneypunct<wchar_t,true> |