<string>

std::string

typedef basic_string<char> string;
String class
Strings are objects that represent sequences of characters.

标准stringclass provides support for such objects with an interface similar to that of a standard container of bytes, but adding features specifically designed to operate with strings of single-byte characters.

要放回的字符的stringclass is an instantiation of the basic_string class template that useschar(i.e., bytes) as its character type, with its default char_traits and allocator types (see basic_string for more info on the template).

Note that this class handles bytes independently of the encoding used: If used to handle sequences of multi-byte or variable-length characters (such as UTF-8), all members of this class (such as length or size), as well as its iterators, will still operate in terms of bytes (not actual encoded characters).

成员类型

成员类型定义
value_typechar
traits_typechar_traits<char>
allocator_typeallocator<char>
引用char&
const_referenceconst char&
指针char*
const_pointerconst char*
iterator一个指向char(convertible toconst_iterator)
const_iterator一个指向const char
reverse_iteratorreverse_iterator<iterator>
const_reverse_iteratorreverse_iterator<const_iterator>
difference_typeptrdiff_t
size_typesize_t

成员函数


迭代器:

容量:

元素访问:

修改器:

String operations:

成员常量


非成员函数重载