Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
complex
exception
functional
iterator
limits
locale
memory
new
numeric
stdexcept
typeinfo
utility
valarray
locale
has_facet
isalnum
isalpha
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
locale
tolower
toupper
use_facet
standard facets:
codecvt
codecvt_base
codecvt_byname
collate
collate_byname
ctype
ctype_base
ctype_byname
messages
messages_base
messages_byname
moneypunct
moneypunct_byname
money_base
money_get
money_put
numpunct
numpunct_byname
num_get
num_put
time_base
time_get
time_get_byname
time_put
time_put_byname
codecvt
codecvt::codecvt
public member functions:
codecvt::always_noconv
codecvt::encoding
codecvt::in
codecvt::length
codecvt::max_length
codecvt::out
codecvt::unshift
public member types:
codecvt::extern_type
codecvt::intern_type
codecvt::result
codecvt::state_type
protected members:
codecvt::do_always_noconv
codecvt::do_encoding
codecvt::do_in
codecvt::do_length
codecvt::do_max_length
codecvt::do_out
codecvt::do_unshift
codecvt::~codecvt


codecvt

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

Convert codeset facet

codecvt


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.