class template
template <class internT, class externT, class stateT> class codecvt;

Convert codeset facet


The codecvt standard facet is used to translate between different character encoding systems (such as multi-byte, UTF-16, ...)

codecvt objects are prevented to be locally constructed by having a protected destructor. Only those installed in locale objects should be used through mechanisms such as use_facet.

This template class has three template parameters, representing the internal character type, the external character type and the conversion state type. They are referred inside this entire reference as internT, externT and unshift, respectively:
template <class internT, class externT, class stateT> codecvt;

The class defines three member aliases for these types: codecvt::intern_type, codecvt::extern_type and codecvt::state_type.

The internal character type is the base type used for translations, while the external character type is its counterpart in the translation. Translations can be performed in either direction with member functions codecvt::in and codecvt::out.

The conversion state type is the type of the object used to keep the state status in a particular translation, more generally used in variable-width character encodings. It is generally mbstate_t or some other compatible type.

Public members

It includes the following public member functions:

Conversion functions:

Character encoding properties:

Along with the following public member types:

Virtual protected members

The class defines the virtual protected members in charge of implementing the expected behavior of their corresponding public member functions:

Including the class destructor

codecvt specialization: codecvt<char,char,mbstate_t>

Both the internal and external types are the narrow character type. This specialization performs no conversions at all

codecvt specialization: codecvt<wchar_t,char,mbstate_t>

Converts between the two fundamental character types using the system's native character set equivalences.