locale();
explicit locale(const char *s);
locale(const locale& x, const locale& y,
category cat);
locale(const locale& x, const char *s, category cat);
The first constructor initializes the object to match the global locale. The second constructor initializes all the locale
categories to have behavior consistent with the locale name s
. The remaining constructors copy x
, with the exceptions
noted:
locale(const locale& x, const locale& y,
category cat);
replaces from y
those facets corresponding to a category c
for which c & cat
is nonzero.
locale(const locale& x, const char *s, category cat);
replaces from locale(s, all)
those facets corresponding to a category c
for which c & cat
is nonzero.
In this implementation, you should write _ADDFAC
(loc, Facet)
to return a new locale that adds the facet Facet
to
the locale loc
, since not all translators currently support the additional template constructors:
template<class Facet>
locale(const locale& x, Facet *fac);
template<class Facet>
locale(const locale& x, const locale& y);
If a locale name s
is a null pointer or otherwise invalid, the function throws runtime_error
.