Namespaces
Variants
Views
Actions

std::wstring_convert

From cppreference.com
< cpp‎ | locale
Revision as of 13:01, 12 February 2012 by Cubbi (Talk | contribs)

Template:cpp/locale/wstring convert/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <locale>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
template< class Codecvt,

          class Elem = wchar_t,
          class Wide_alloc = std::allocator<Elem>,
          class Byte_alloc = std::allocator<char> >

class wstring_convert;
</td>

<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

Template:cpp/locale/wstring convert/dcl list from bytesTemplate:cpp/locale/wstring convert/dcl list to bytes
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>
codecvt_utf8_utf16<char16_t>
codecvt_utf8_utf16<char32_t>
codecvt_utf8_utf16<wchar_t>

N/A
UCS-2 c16rtomb (without C11's DR488) codecvt_utf8<char16_t> codecvt_utf16<char16_t>
UTF-32

mbrtoc32 / c32rtomb

codecvt<char32_t,char,mbstate_t>
codecvt_utf8<char32_t>

codecvt_utf16<char32_t>

system wchar_t:

UTF-32 (non-Windows)
UCS-2 (Windows)

mbsrtowcs / wcsrtombs
use_facet<codecvt
<wchar_t,char,mbstate_t>>(locale)

codecvt_utf8<wchar_t> codecvt_utf16<wchar_t>
Template:cpp/locale/dcl list wbuffer convertTemplate:cpp/locale/dcl list codecvt utf8Template:cpp/locale/dcl list codecvt utf8 utf16