wstring_convert Class

The template class wstring_convert performs conversions between a wide string and a byte string.

template<
    class Codecvt,
    class Elem = wchar_t
>
class wstring_convert

Parameters

  • Codecvt
    The locale facet that represents the conversion object.

  • Elem
    The wide-character element type.

Remarks

The template class describes an object that controls conversions between wide string objects of class std::basic_string<Elem> and byte string objects of class std::basic_string<char> (also known as std::string). The template class defines the types wide_string and byte_string as synonyms for these two types. Conversion between a sequence of Elem values (stored in a wide_string object) and multibyte sequences (stored in a byte_string object) is performed by an object of class Codecvt<Elem, char, std::mbstate_t>, which meets the requirements of the standard code-conversion facet std::codecvt<Elem, char, std::mbstate_t>.

An object of this template class stores:

  • A byte string to display on errors

  • A wide string to display on errors

  • A pointer to the allocated conversion object (which is freed when the wbuffer_convert object is destroyed)

  • A conversion state object of type state_type

  • A conversion count

Requirements

Header: <cvt/wstring>

Namespace: stdext::cvt

See Also

Other Resources

<cvt/wstring> Members

wstring_convert Members