名稱空間
變體
操作

std::multimap<Key,T,Compare,Allocator>::emplace_hint

來自 cppreference.com
< cpp‎ | 容器‎ | multimap
 
 
 
 
template< class... Args >
iterator emplace_hint( const_iterator hint, Args&&... args );
(C++11 起)

將新元素插入到容器中,儘可能靠近 hint 之前的位置。

元素型別(`value_type`,即 std::pair<const Key, T>)的建構函式被呼叫,其引數與提供給函式的引數完全相同,並用 std::forward<Args>(args)... 轉發。

迭代器或引用均未失效。

目錄

[編輯] 引數

hint - 指向新元素將插入位置之前的迭代器
args - 轉發給元素建構函式的引數

[編輯] 返回值

指向已插入元素的迭代器。

[編輯] 異常

如果由於任何原因丟擲異常,此函式無效果(強異常安全保證)。

[編輯] 複雜度

通常為容器大小的對數級,但如果新元素剛好插入在 hint 之前,則為攤銷常數級。

[編輯] 示例

[編輯] 參閱

(C++11)
就地構造元素
(public 成員函式) [編輯]
插入元素 或節點(C++17 起)
(public 成員函式) [編輯]
English 日本語 中文(简体) 中文(繁體)