std::basic_string

来自cppreference.com
 
 
字符串库
null结尾的字符串
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
字节的字符串
多字节字符串
宽字符串
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string
char_traits
 
std::basic_string
成员函数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::basic_string
basic_string::operator=
basic_string::assign
basic_string::get_allocator
元素的访问
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::at
basic_string::operator[]
basic_string::front(C++11)
basic_string::back(C++11)
basic_string::data
basic_string::c_str
迭代器
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::begin
basic_string::cbegin

(C++11)
basic_string::end
basic_string::cend

(C++11)
basic_string::rbegin
basic_string::crbegin

(C++11)
basic_string::rend
basic_string::crend

(C++11)
容量
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::empty
basic_string::size
basic_string::length
basic_string::max_size
basic_string::reserve
basic_string::capacity
basic_string::shrink_to_fit(C++11)
操作
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::clear
basic_string::insert
basic_string::erase
basic_string::push_back
basic_string::pop_back(C++11)
basic_string::append
basic_string::operator+=
basic_string::compare
basic_string::replace
basic_string::substr
basic_string::copy
basic_string::resize
basic_string::swap
搜索
Original:
Search
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::find
basic_string::rfind
basic_string::find_first_of
basic_string::find_first_not_of
basic_string::find_last_of
basic_string::find_last_not_of
常量
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::npos
非成员函数
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator+
operator==
operator!=
operator<
operator>
operator<=
operator>=
swap(std::basic_string)
operator<<
operator>>
getline
stoi
stol
stoll
(C++11)
(C++11)
(C++11)
stoul
stoull
(C++11)
(C++11)
stof
stod
stold
(C++11)
(C++11)
(C++11)
to_string(C++11)
to_wstring(C++11)
Helper类
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
hash<std::string>
hash<std::wstring>
hash<std::u32string>
hash<std::u16string>
(C++11)
 
Defined in header <string>
template<

    class CharT,
    class Traits = std::char_traits<CharT>,
    class Allocator = std::allocator<CharT>

> class basic_string;
类模板basic_string存储和处理序列的字符对象(即对象的专业化std::char_traits或兼容的特性类).
Original:
The class template basic_string stores and manipulates sequences of char-like objects (that is, objects for which a specialization of std::char_traits or compatible traits class is provided).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
元素的basic_string中连续存储的,也就是说,对于一个basic_strings&*(s.begin() + n) == &*s.begin() + n[0, s.size())任何中的n,或者,等价地,一个指针到s[0]可以传递给预期一个charT[]阵列的第一个元素的指针的函数。 (C++11 起)
Original:
The elements of a basic_string are stored contiguously, that is, for a basic_string s, &*(s.begin() + n) == &*s.begin() + n for any n in [0, s.size()), or, equivalently, a pointer to s[0] can be passed to functions that expect a pointer to the first element of a charT[] array. (C++11 起)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
一些常见的字符类型专业提供:
Original:
Several specializations for common character types are provided:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Defined in header <string>
类型
Original:
Type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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>

目录

[编辑] 会员类型

会员类型
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
traits_type Traits
value_type Traits::char_type
allocator_type Allocator [edit]
size_type
无符号整数类型(通常是size_t
Original:
Unsigned integral type (usually size_t)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]
difference_type Signed integer type (usually ptrdiff_t) [edit]
reference Allocator::reference (至 C++11)
value_type& (C++11 起) [edit]
const_reference Allocator::const_reference (至 C++11)
const value_type& (C++11 起) [edit]
pointer Allocator::pointer (至 C++11)
std::allocator_traits<Allocator>::pointer (C++11 起) [edit]
const_pointer Allocator::const_pointer (至 C++11)
std::allocator_traits<Allocator>::const_pointer (C++11 起) [edit]
iterator RandomAccessIterator [edit]
const_iterator
恒随机访问迭代器
Original:
Constant random access iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]
reverse_iterator std::reverse_iterator<iterator> [edit]
const_reverse_iterator std::reverse_iterator<const_iterator> [edit]

[编辑] 成员函数

构建了一个basic_string
Original:
constructs a basic_string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
指定的字符串值
Original:
assigns values to the string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
将字符分配给一个字符串
Original:
assign characters to a string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
返回的关联分配器
Original:
returns the associated allocator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
元素的访问
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
访问指定的字符的边界检查
Original:
access specified character with bounds checking
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
访问指定的字符
Original:
access specified character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
(C++11)
访问的第一个字符
Original:
accesses the first character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
(C++11)
访问的最后一个字符
Original:
accesses the last character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
返回一个指针,指向一个字符串的第一个字符
Original:
returns a pointer to the first character of a string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
返回一个不可修改的标准C字符数组版本的字符串
Original:
returns a non-modifiable standard C character array version of the string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
迭代器
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(C++11)
返回一个迭代的开始
Original:
returns an iterator to the beginning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]

(C++11)
返回一个迭代的结束
Original:
returns an iterator to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]

(C++11)
返回一个反向迭代的开始
Original:
returns a reverse iterator to the beginning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]

(C++11)
返回一个反向迭代结束
Original:
returns a reverse iterator to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
容量
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
检查字符串是否为空
Original:
checks whether the string is empty
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
returns the number of characters
(公共成员函数) [edit]
返回的最大字符数
Original:
returns the maximum number of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
储备存储
Original:
reserves storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
返回数字的字符,可以保持在当前分配的存储空间
Original:
returns the number of characters that can be held in currently allocated storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
(C++11)
通过释放未使用的内存减少了内存的使用情况
Original:
reduces memory usage by freeing unused memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
操作
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
清除其内容
Original:
clears the contents
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
插入字符
Original:
inserts characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
removes characters
(公共成员函数) [edit]
添加一个字符的结束
Original:
appends a character to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
(C++11)
删除最后一个字符
Original:
removes the last character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
追加到结束的字符
Original:
appends characters to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
追加到结束的字符
Original:
appends characters to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
比较两个字符串
Original:
compares two strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
替换出现的每一个指定的字符
Original:
replaces every occurrence of specified characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
返回一个子字符串
Original:
returns a substring
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
副本字符
Original:
copies characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
改变存储的字符数
Original:
changes the number of characters stored
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
交换的内容
Original:
swaps the contents
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
搜索
Original:
Search
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
找到字符串中的字符
Original:
find characters in the string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
找到一个子字符串最后一次出现的
Original:
find the last occurrence of a substring
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
第一次出现的字符
Original:
find first occurrence of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
找到第一个没有的字符
Original:
find first absence of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
最后一次出现的字符
Original:
find last occurrence of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]
找到最后没有的字符
Original:
find last absence of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成员函数) [edit]

常量
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[静态的] </ SPAN></div></div>
特殊的价值。的确切含义取决于具体情况
Original:
special value. The exact meaning depends on the context
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共静态成员常量) [edit]

[编辑] 非成员函数

连接两个字符串或一个字符串和一个字符
Original:
concatenates two strings or a string and a char
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数模板) [edit]
按字典顺序比较两个字符串
Original:
lexicographically compares two strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数模板) [edit]
专业的std::swap算法
Original:
specializes the std::swap algorithm
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数模板) [edit]
输入/输出
Original:
Input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
执行流I / O字符串
Original:
performs stream I/O on strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数模板) [edit]
读取数据的I / O流成一个字符串
Original:
read data from an I/O stream into a string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
数字的转换
Original:
Numeric conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
将字符串转换为一个有符号整数
Original:
converts a string to an signed integer
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
(C++11)
(C++11)
将字符串转换为无符号整数
Original:
converts a string to an unsigned integer
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
(C++11)
(C++11)
(C++11)
将字符串转换为浮点值
Original:
converts a string to an floating point value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
(C++11)
string转换为整数或浮点值
Original:
converts an integral or floating point value to string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
(C++11)
wstring转换为整数或浮点值
Original:
converts an integral or floating point value to wstring
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]

[编辑] Helper类

字符串哈希支持
Original:
hash support for strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(类模板专业化) [edit]
来自“http://zh.cppreference.com/mwiki/index.php?title=cpp/string/basic_string&oldid=26398