function template
template <class Facet> const Facet& use_facet ( const locale& loc );

Access facet of locale

Returns a reference to facet Facet of locale loc.

If the facet is not present in the locale, the function throws a bad_cast exception.

The function has_facet can be used to check if a locale has a particular facet present before attempting to use it.


locale object.

The template parameter Facet shall be a facet type.
A facet type is a type publicly derived, directly or indirectly, from locale::facet with a static member id of type locale::id, such as the standard facets collate, codecvt, ctype, messages, moneypunct, money_get, money_put, numpunct, num_get, num_put, time_get and time_put.

Return type

A reference to the facet object.

See also