Share via


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

Constructors

wstring_convert

Constructs an object of type wstring_convert.

Typedefs

byte_string

A type that represents a byte string.

wide_string

A type that represents a wide string.

state_type

A type that represents the conversion state.

int_type

A type that represents an integer.

Member Functions

from_bytes

Converts a byte string to a wide string.

to_bytes

Converts a wide string to a byte string.

converted

Returns the number of successful conversions.

state

Returns an object representing the state of the conversion.

Requirements

Header: <cvt/wstring>

Namespace: stdext::cvt

See Also

Other Resources

<cvt/wstring> Members

wstring_convert Members