std::basic_string::operator=
来自cppreference.com
< cpp | string | basic string
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| basic_string& operator=( const basic_string& str ); |
(1) | |
| basic_string& operator=( basic_string&& str ); |
(2) | (C++11 起) |
| basic_string& operator=( const CharT* s ); |
(3) | |
| basic_string& operator=( CharT ch ); |
(4) | |
| basic_string& operator=( std::initializer_list<CharT> ilist ); |
(5) | (C++11 起) |
替换的字符串的内容.
1) str的副本的内容替换原文:
Replaces the contents with a copy of
str的
3) str使用移动语义的内容替换。 str是在不确定的状态,手术后.原文:
Replaces the contents with those of
str using move semantics. str is in undefined state after the operation.指出,
4) s以NULL结尾的字符串的内容替换. 原文:
Replaces the contents with those of null-terminated character string pointed to by
s. 的内容替换字符
8) ch原文:
Replaces the contents with character
ch与初始化列表中的内容替换
ilist.原文:
Replaces the contents with those of the initializer list
ilist.目录 |
[编辑] 参数
| ch | - | 值来初始化字符的字符串
原文: value to initialize characters of the string with |
| str | - | 字符串可以用于作为源初始化字符串
原文: string to be used as source to initialize the string with |
| s | - | 一个空termanated字符的字符串
to用作源初始化字符串的指针 原文: pointer to a null-termanated character string to use as source to initialize the string with |
| init | - | 初始化列表中初始化字符串
原文: initializer list to initialize the string with |
[编辑] 返回值
*this
[编辑] 复杂度
1)线性大小
2) str不变。如果
3) alloc,并给出alloc != other.get_allocator(),则采用线性.原文:
constant. If
alloc is given and alloc != other.get_allocator(), then linear.线性大小
4) s恒定
5) 线性大小
init[编辑] 示例
| 本章尚未完成 原因:暂无示例 |
[编辑] 另请参阅
| 构造 basic_string (公开成员函数) | |
| 为字符串赋值 (公开成员函数) |