std::locale:: facet
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member types | ||||
|
locale::facet
|
||||
| Member functions | ||||
|
(C++26)
|
||||
|
(until C++20)
|
||||
| Static member functions | ||||
|
Defined in header
<locale>
|
||
|
class
locale
::
facet
;
|
||
std::locale::facet
is the base class for facets. It provides a common base class so that locales could store pointers to the facets they implement in a single indexed container, and it abstracts support for facet reference counting.
Whenever a facet is added to a locale, the locale increments the reference count in the facet (through an implementation-specific mechanism). Whenever a locale is destructed or modified, it decrements the reference count in each facet it no longer implements. Whenever a facet's reference count becomes zero, the locale performs delete static_cast < std :: locale :: facet * > ( f ) ; where f is the pointer to the facet.
Contents |
Facet class
A class is a facet if
- it is publicly derived from another facet, or
-
it is a class derived from
std::locale::facetand contains a publicly accessible declaration as follows:
static :: std:: locale :: id id ;
Member functions
|
constructs a new facet with specified reference count
(protected member function) |
|
|
operator=
|
the copy assignment operator is deleted
(protected member function) |
|
(destructor)
[virtual]
|
the destructor is protected virtual
(virtual protected member function) |
Example
|
This section is incomplete
Reason: no example |
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2694 | C++98 | the definition of 'facet' was removed by the resolution of LWG issue 436 | added the definition back |
See also
|
the facet index type: each facet class must declare or inherit a public static member of this type
(class) |