std::wstring_convert
STD::wstring[医]转换
Defined in header | | |
---|
template< class Codecvt, class Elem = wchar_t, class Wide_alloc = std::allocator<Elem>, class Byte_alloc = std::allocator<char> > class wstring_convert; | | (since C++11) (deprecated in C++17) |
类模板std::wstring_convert执行字节字符串之间的转换。std::string宽绳std::basic_string<Elem>,使用单独的代码转换方面。Codecvt...std::wstring_convert假定转换面的所有权,并且不能使用由区域设置管理的方面。适用于与std::wstring_convert是std::codecvt_utf8对于UTF-8/UC 2和UTF-8/UC 4转换和std::codecvt_utf8_utf16对于UTF-8/UTF-16转换。
成员类型
Member type | Definition |
---|
byte_string | std::basic_string<char, char_traits<char>, Byte_alloc> |
wide_string | std::basic_string<Elem, char_traits<Elem>, Wide_alloc> |
state_type | Codecvt::state_type |
int_type | wide_string::traits_type::int_type |
成员函数
(constructor) | constructs a new wstring_convert (public member function) |
---|
operator= | the copy assignment operator is deleted (public member function) |
(destructor) | destructs the wstring_convert and its conversion facet (public member function) |
from_bytes | converts a byte string into a wide string (public member function) |
to_bytes | converts a wide string into a byte string (public member function) |
converted | returns the number of characters successfully converted (public member function) |
state | returns the current conversion state (public member function) |
另见
Characterconversions | 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 |
UCS2 | c16rtomb(without C11's DR488) | codecvt_utf8<char16_t> codecvt_utf8<wchar_t>(Windows). | codecvt_utf16<char16_t> codecvt_utf16<wchar_t>(Windows). |
UTF-32 | mbrtoc32 / c32rtomb. | codecvt<char32_t, char, mbstate_t> codecvt_utf8<char32_t> codecvt_utf8<wchar_t>(non-Windows). | codecvt_utf16<char32_t> codecvt_utf16<wchar_t>(non-Windows). |
system wide:UTF-32(non-Windows)UCS2(Windows) | mbsrtowcs / wcsrtombs use_facet<codecvt <wchar_t, char, mbstate_t>>(locale). | No | No |
wbuffer_convert (C++11)(deprecated in C++17) | performs conversion between a byte stream buffer and a wide stream buffer (class template) |
---|
codecvt_utf8 (C++11)(deprecated in C++17) | converts between UTF-8 and UCS2/UCS4 (class template) |
codecvt_utf8_utf16 (C++11)(deprecated in C++17) | converts between UTF-8 and UTF-16 (class template) |
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
http://en.cppreference.com/w/cpp/locale/wstring[医]转换