use_facet

template<class Facet>
    const Facet& use_facet(const locale& loc,
        const Facet *fac, bool make_it);

The template function returns a reference to the locale facet of class Facet listed within the locale object loc. If no such object is listed, the function throws an object of class bad_cast.

In this implementation, make_it instructs the function to generate the locale facet on demand. But you should write _USE(loc, Facet), or _USEFAC(loc, Facet) in place of use_facet(loc, (Facet *)0, make_it), because the second and third parameters are a nonstandard extension. The former is strongly preferred when looking up a facet that should always be present -- it generates the requested facet on demand, if necessary. The latter will report that the locale initially constructed by locale() has no facets.


Send feedback to MSDN.Look here for MSDN Online resources.