std::list::assign
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| void assign( size_type count, const T& value ); |
(1) | |
| template< class InputIt > void assign( InputIt first, InputIt last ); |
(2) | |
替换该容器的内容.
1) 原文:
Replaces the contents of the container.
count价值value副本的内容替换原文:
replaces the contents with
count copies of value value的内容替换的范围内
[first, last)的副本原文:
replaces the contents with copies of those in the range
[first, last)目录 |
[编辑] 参数
| count | - | 容器的新的大小
|
| value | - | 的值初始化容器的元素
原文: the value to initialize elements of the container with |
| first, last | - | 取值范围为从复制元素
|
| 类型要求 | ||
-InputIt 必须满足 InputIterator 的要求。
| ||
[编辑] 复杂性
1)线性
2) countfirst和last之间的距离呈线性关系原文:
linear in distance between
first and last[编辑] 为例
下面的代码使用
assign添加一个std::list<char>几个字符
原文:
The following code uses
assign to add several characters to a std::list<char>:
输出:
a a a a a
[编辑] 另请参阅
| 构建 list (公共成员函数) | |