.\" ident @(#)has_facet.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH has_facet 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2has_facet\fP \ - A function template used to determine if a locale has a given facet. .SH SYNOPSIS .br #include .br template bool has_facet(const locale&) throw(); .SH DESCRIPTION has_facet returns \f2true\fP if the requested facet is available in the locale. Otherwise it returns \f2false\fP. You specify the facet type by explicitly including the template parameter (see the example below). Note that if your compiler cannot overload function templates on return type, then you need to use an alternative_has_facet template. The alternative template takes an additional argument that's a pointer to the type of facet you want to check on. The declaration looks like this: .br template .br const bool has_facet(const locale&, Facet*) throw(); The example below shows the use of both variations of has_facet. .SH EXAMPLE .br // .br // hasfacet.cpp .br // .br .br #include .br .br int main () .br { .RE .RS 1 using namespace std; .RE .RS 0 .RE .RS 1 locale loc; .RE .RS 0 .br #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE .RE .RS 1 cout << has_facet >(loc) << endl; .RE .RS 0 #else .RE .RS 1 cout << has_facet(loc,(ctype*)0) << endl; .RE .RS 0 #endif .RE .RS 1 .br return 0; .RE .RS 0 } .SH SEE ALSO locale, facets, use_facet