[locale.cons] (original) (raw)
28 Localization library [localization]
28.3 Locales [locales]
28.3.1 Class locale [locale]
28.3.1.2 Constructors and destructor [locale.cons]
Effects:Constructs a copy of the argument last passed tolocale::global(locale&), if it has been called; else, the resulting facets have virtual function semantics identical to those oflocale::classic().
[ Note
:
This constructor yields a copy of the current global locale.
It is commonly used as a default argument for function parameters of type const locale&.
— end note
]
explicit locale(const char* std_name);
Effects:Constructs a locale using standard C locale names, e.g., "POSIX".
The resulting locale implements semantics defined to be associated with that name.
Throws: runtime_errorif the argument is not valid, or is null.
Remarks:The set of valid string argument values is "C", "", and any implementation-defined values.
explicit locale(const string& std_name);
Effects:The same as locale(std_name.c_str()).
locale(const locale& other, const char* std_name, category);
Effects:Constructs a locale as a copy ofotherexcept for the facets identified by thecategoryargument, which instead implement the same semantics aslocale(std_name).
Throws: runtime_errorif the argument is not valid, or is null.
Remarks:The locale has a name if and only ifotherhas a name.
locale(const locale& other, const string& std_name, category cat);
Effects:The same as locale(other, std_name.c_str(), cat).
template<class Facet> locale(const locale& other, Facet* f);
Effects:Constructs a locale incorporating all facets from the first argument except that of typeFacet, and installs the second argument as the remaining facet.
If fis null, the resulting object is a copy of other.
Remarks:The resulting locale has no name.
locale(const locale& other, const locale& one, category cats);
Effects:Constructs a locale incorporating all facets from the first argument except those that implementcats, which are instead incorporated from the second argument.
Remarks:The resulting locale has a name if and only if the first two arguments have names.
const locale& operator=(const locale& other) noexcept;
Effects:Creates a copy of other, replacing the current value.