std::has_facet (3) - Linux Manuals
std::has_facet: std::has_facet
Command to display std::has_facet
manual in Linux: $ man 3 std::has_facet
NAME
std::has_facet - std::has_facet
Synopsis
Defined in header <locale>
template< class Facet > (until C++11)
bool has_facet( const locale& loc ) throw();
template< class Facet > (since C++11)
bool has_facet( const locale& loc ) noexcept;
Checks if the locale loc implements the facet Facet.
Parameters
loc - the locale object to query
Return value
Returns true if the facet Facet was installed in the locale loc, false otherwise.
Example
// Run this code
#include <iostream>
#include <locale>
// minimal custom facet
struct myfacet : public std::locale::facet {
static std::locale::id id;
};
std::locale::id myfacet::id;
int main()
{
// loc is a "C" locale with myfacet added
std::locale loc(std::locale::classic(), new myfacet);
std::cout << std::boolalpha
<< "Can loc classify chars? "
<< std::has_facet<std::ctype<char>>(loc) << '\n'
<< "Can loc classify char32_t? "
<< std::has_facet<std::ctype<char32_t>>(loc) << '\n'
<< "Does loc implement myfacet? "
<< std::has_facet<myfacet>(loc) << '\n';
}
Output:
Can loc classify chars? true
Can loc classify char32_t? false
Does loc implement myfacet? true
See also
set of polymorphic facets that encapsulate cultural differences
locale (class)
obtains a facet from a locale
use_facet (function template)
Pages related to std::has_facet
- std::has_trivial_copy_assign (3)
- std::has_trivial_copy_constructor (3)
- std::has_trivial_default_constructor (3)
- std::has_unique_object_representations (3) - std::has_unique_object_representations
- std::has_virtual_destructor (3) - std::has_virtual_destructor
- std::hash(std::bitset) (3) - std::hash(std::bitset)
- std::hash(std::experimental::observer_ptr) (3) - std::hash(std::experimental::observer_ptr)
- std::hash(std::experimental::propagate_const) (3) - std::hash(std::experimental::propagate_const)
- std::hash(std::experimental::shared_ptr) (3) - std::hash(std::experimental::shared_ptr)
- std::hash(std::experimental::string_view,std::experimental::wstring_view, (3) - std::hash(std::experimental::string_view,std::experimental::wstring_view,
- std::hash(std::experimental::string_view,std::experimental::wstring_view,std::experimental::u16string_view,std::experimental::u32string_view) (3) - std::hash(std::experimental::string_view,std::experimental::wstring_view,std::experimental::u16string_view,std::experimental::u32string_view)
- std::hash(std::shared_ptr) (3) - std::hash(std::shared_ptr)