std::wstring_convert
Template:cpp/locale/wstring convert/sidebar Template:ddcl list begin <tr class="t-dsc-header">
<td><locale>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td > class Elem = wchar_t,
class Wide_alloc = std::allocator<Elem>,
class Byte_alloc = std::allocator<char> >
<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> Template:ddcl list end
Class template Template:cpp performs conversions between byte string Template:cpp and wide string Template:cpp, using an individual code conversion facet Codecvt
. Template:cpp assumes ownership of the conversion facet, and cannot use a facet managed by a locale. The standard facets suitable for use with Template:cpp are Template:cpp for UTF-8/UCS2 and UTF-8/UCS4 conversions and Template:cpp for UTF-8/UTF-16 conversions.
Member types
Template:tdcl list begin Template:tdcl list hitem Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list end
Member functions
constructs a new wstring_convert (public member function) | |
destructs the wstring_convert and its conversion facet (public member function) | |
returns the number of input characters successfully converted (public member function) | |
returns the current shift state (public member function) |
See also
Character conversions |
locale-defined multibyte (UTF-8, GB18030) |
UTF-8 |
UTF-16 |
---|---|---|---|
UTF-16 | mbrtoc16 / c16rtomb (with C11's DR488) |
codecvt<char16_t,char,mbstate_t> |
N/A |
UCS-2 | c16rtomb (without C11's DR488) | codecvt_utf8<char16_t> | codecvt_utf16<char16_t> |
UTF-32 |
codecvt<char32_t,char,mbstate_t> |
codecvt_utf16<char32_t> | |
system wchar_t:
UTF-32 (non-Windows) |
mbsrtowcs / wcsrtombs |
codecvt_utf8<wchar_t> | codecvt_utf16<wchar_t> |