Namespaces
Variants

std:: wstring_convert

From cppreference.net
헤더 파일에 정의됨 <locale>
template <

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

> class wstring_convert ;
(C++11부터)
(C++17부터 사용 중단)
(C++26에서 제거됨)

클래스 템플릿 std::wstring_convert 는 바이트 문자열 std::string 과 와이드 문자열 std:: basic_string < Elem > 사이의 변환을 수행하며, 개별 코드 변환 패싯 Codecvt 를 사용합니다. std::wstring_convert 는 변환 패싯의 소유권을 가지며, 로캘에 의해 관리되는 패싯을 사용할 수 없습니다.

std::wstring_convert 와 함께 사용하기 적합한 표준 패싯은 UTF-8/UCS-2 및 UTF-8/UCS-4 변환을 위한 std::codecvt_utf8 과 UTF-8/UTF-16 변환을 위한 std::codecvt_utf8_utf16 입니다.

목차

중첩 타입

유형 정의
byte_string std:: basic_string < char , std:: char_traits < char > , Byte_alloc >
wide_string std:: basic_string < Elem, std:: char_traits < Elem > , Wide_alloc >
state_type typename Codecvt :: state_type
int_type typename wide_string :: traits_type :: int_type

데이터 멤버

멤버 설명
byte_string byte_err_string 오류 발생 시 표시할 바이트 문자열
( 설명 전용 멤버 객체* )
wide_string wide_err_string 오류 발생 시 표시할 와이드 문자열
( 설명 전용 멤버 객체* )
Codecvt * cvtptr 할당된 변환 객체에 대한 포인터
( 설명 전용 멤버 객체* )
state_type cvtstate 변환 상태 객체
( 설명 전용 멤버 객체* )
std:: size_t cvtcount 변환 횟수
( 설명 전용 멤버 객체* )

멤버 함수

새로운 wstring_convert 를 생성합니다
(public member function)
operator=
복사 할당 연산자는 삭제됨
(public member function)
wstring_convert 와 그 변환 패싯을 소멸시킵니다
(public member function)
바이트 문자열을 와이드 문자열로 변환합니다
(public member function)
와이드 문자열을 바이트 문자열로 변환합니다
(public member function)
성공적으로 변환된 문자 수를 반환합니다
(public member function)
현재 변환 상태를 반환합니다
(public member function)

참고 항목

문자 변환
로케일 정의 멀티바이트
(UTF-8, GB18030)
UTF-8
UTF-16
UTF-16 mbrtoc16 / c16rtomb (C11의 DR488 포함)

codecvt < char16_t , char ,mbstate_t >
codecvt_utf8_utf16 < char16_t >
codecvt_utf8_utf16 < char32_t >
codecvt_utf8_utf16 < wchar_t >

해당 없음
UCS-2 c16rtomb (C11의 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 >

시스템 wchar_t :

UTF-32 (비윈도우)
UCS-2 (윈도우)

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

codecvt_utf8 < wchar_t > codecvt_utf16 < wchar_t >
(C++11) (deprecated in C++17) (removed in C++26)
바이트 스트림 버퍼와 와이드 스트림 버퍼 간 변환 수행
(클래스 템플릿)
(C++11) (deprecated in C++17) (removed in C++26)
UTF-8과 UCS-2/UCS-4 간 변환
(클래스 템플릿)
(C++11) (deprecated in C++17) (removed in C++26)
UTF-8과 UTF-16 간 변환
(클래스 템플릿)