std::multiset::insert
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
iterator insert( const value_type& value ); |
(1) | |
iterator insert( value_type&& value ); |
(2) | (C++11 起) |
iterator insert( iterator hint, const value_type& value ); iterator insert( const_iterator hint, const value_type& value ); |
(3) | (至 C++11) (C++11 起) |
iterator insert( const_iterator hint, value_type&& value ); |
(4) | (C++11 起) |
template< class InputIt > void insert( InputIt first, InputIt last ); |
(5) | |
void insert( std::initializer_list<value_type> ilist ); |
(6) | (C++11 起) |
Inserts element(s) to the container.
1-2)插入
value
。 If the container has elements with equivalent key, inserts at the upper bound of that range.(C++11 起)原文:
inserts
value
. If the container has elements with equivalent key, inserts at the upper bound of that range.(C++11 起)3-4) inserts value
in the position as close as possible, just prior(C++11 起), to hint
.
插入元素范围
6) [first, last)
.原文:
inserts elements from range
[first, last)
.从初始化列表中插入元素
ilist
.原文:
inserts elements from initializer list
ilist
.No iterators or references are invalidated.
目录 |
[编辑] 参数
hint | - | 迭代器,用于插入内容,作为一个建议
原文: iterator, used as a suggestion as to where to insert the content |
value | - | 元素的值插入
|
first, last | - | 范围插入的元素
|
ilist | - | 初始化列表中插入的值
原文: initializer list to insert the values from |
类型要求 | ||
-InputIt 必须满足 InputIterator 的要求。
|
[编辑] 返回值
1-2) returns an iterator to the inserted element.
3-4) returns an iterator to the inserted element.
5-6)无
[编辑] 复杂性
1-2) Logarithmic in the size of the container, O(log(size()))
.
3-4) Amortized constant if the insertion happens in the position just after(至 C++11)/before(C++11 起) the hint, logarithmic in the size of the container otherwise.
5-6) O(N*log(size() + N))
, where N is the number of elements to insert.
[编辑] 另请参阅
(C++11) |
就地构造元素 (公共成员函数) |
(C++11) |
构建了一丝元素的地方使用 原文: constructs elements in-place using a hint (公共成员函数) |