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 typeA reference to the facet object.
|has_facet||Check if locale has facet (function template)|
|locale::facet||Locale facet (public member class)|