std::multiset<Key,Compare,Allocator>:: emplace_hint
From cppreference.net
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::multiset
| Member functions | |||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
| Deduction guides (C++17) | |||||||||||||||||||||||||||
|
template
<
class
...
Args
>
iterator emplace_hint ( const_iterator hint, Args && ... args ) ; |
(自 C++11 起)
(自 C++26 起为 constexpr) |
|
在容器中插入一个新元素,尽可能靠近 hint 所指向位置的前方。
键与映射值的构造函数将以与传递给函数时完全相同的参数被调用,这些参数通过 std:: forward < Args > ( args ) ... 进行完美转发。
不会使任何迭代器或引用失效。
目录 |
参数
| hint | - | 指向新元素将要插入位置前一个位置的迭代器 |
| args | - | 要转发给元素构造函数的参数 |
返回值
指向被插入元素的迭代器。
异常
若因任何原因抛出异常,此函数不产生任何效果( 强异常安全保证 )。
复杂度
通常与容器大小呈对数关系,但若新元素恰在 hint 前插入则摊分常数为常数时间。
示例
|
本节内容不完整
原因:缺少示例 |
参见
|
(C++11)
|
原地构造元素
(公开成员函数) |
|
插入元素
或节点
(since C++17)
(公开成员函数) |