이름공간
변수
행위

Strings library

cppreference.com
< cpp
C++ 문자열 라이브러리는 문자열을 가리키는 2가지 일반적인 형태를 지원한다.:
  • std::basic_string - 모든 캐릭터 타입으로 이루어진 문자열을 다루기 위해 설계된 클래스 템플릿
  • 널 종료 문자열- 특수문자일 null'로 끝나는 캐릭터 배열.

목차

[편집] std::basic_string

The templated class std::basic_string generalizes how sequences of characters are manipulated and stored. String creation, manipulation, and destruction are all handled by a convenient set of class methods and related functions.

널리 사용되는 타입을 위해 몇몇 std::basic_string 특수화 버전이 존재한ㄴ다.:

<string> 헤더에 정의됨.
Type Definition
std::string std::basic_string<char>
std::wstring std::basic_string<wchar_t>
std::u16string std::basic_string<char16_t>
std::u32string std::basic_string<char32_t>

[편집] Null-terminated strings

Null-terminated strings are arrays of characters that are terminated by a special null character. C++ provides functions to create, inspect, and modify null-terminated strings.

There are three types of null-terminated strings:

[편집] Additional support

[편집] std::char_traits

The string library also provides class template std::char_traits that defines types and functions for std::basic_string. The following specializations are defined:

<string> 에 정의되어 있음.
template<> class char_traits<std::string>;

template<> class char_traits<std::wstring>;
template<> class char_traits<std::u16string>;

template<> class char_traits<std::u32string>;


(since C++11)
(since C++11)