Freigeben über


codecvt Class

A template class that describes an object that can serve as a locale facet that is able to control conversions between a sequence of values used to encode characters within the program and a sequence of values used to encode characters outside the program.

For a list of all members of this type, see codecvt Members.

template <
   class CharType,
   class Byte,
   class StateType,
> 
class codecvt : public codecvt_base

Parameters

  • CharType
    The type used within a program to encode characters.

  • Byte
    A type used to encode characters outside a program.

  • StateType
    A type that can be used to represent intermediate states of a conversion between internal and external types of character representations.

Remarks

The internal encoding uses a representation with a fixed number of bytes per character, usually either type char or type wchar_t.

As with any locale facet, the static object ID has an initial stored value of zero. The first attempt to access its stored value stores a unique positive value in id.

The template versions of do_in and do_out always return codecvt_base::noconv. The Standard C++ Library defines an explicit specialization, however, that is more useful:

template<> codecvt<wchar_t, char, mbstate_t>

which converts between wchar_t and char sequences.

Requirements

Header: <locale>

Namespace: std

See Also

Concepts

codecvt Members

<locale> Members

Thread Safety in the Standard C++ Library