이름공간
변수
행위

"cpp/string"의 두 판 사이의 차이

cppreference.com
< cpp
(import from en: to simplify translation effort)
 
 
1번째 줄: 1번째 줄:
 
{{title|Strings library}}
 
{{title|Strings library}}
 
{{cpp/string/navbar}}
 
{{cpp/string/navbar}}
 +
  
The C++ strings library includes support for two general types of strings:
+
* {{lc|std::basic_string}} -
 
+
* - ''null'.
* {{lc|std::basic_string}} - a templated class designed to manipulate strings of any character type.
+
* Null-terminated strings - arrays of characters terminated by a special ''null'' character.
+
  
 
=== {{lc|std::basic_string}} ===
 
=== {{lc|std::basic_string}} ===
11번째 줄: 10번째 줄:
 
The templated class {{lc|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.
 
The templated class {{lc|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.
  
Several specializations of {{lc|std::basic_string}} are provided for commonly-used types:
+
{{lc|std::basic_string}} :
  
 
{{dsc begin}}
 
{{dsc begin}}

2018년 1월 27일 (토) 07:45 기준 최신판

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)