cplusplus
.com
教程
參考
文章
論壇
C++
教程
參考
文章
論壇
參考
C 庫
<cassert> (assert.h)
<cctype> (ctype.h)
<cerrno> (errno.h)
C++11
<cfenv> (fenv.h)
<cfloat> (float.h)
C++11
<cinttypes> (inttypes.h)
<ciso646> (iso646.h)
<climits> (limits.h)
<clocale> (locale.h)
<cmath> (math.h)
<csetjmp> (setjmp.h)
<csignal> (signal.h)
<cstdarg> (stdarg.h)
C++11
<cstdbool> (stdbool.h)
<cstddef> (stddef.h)
C++11
<cstdint> (stdint.h)
<cstdio> (stdio.h)
<cstdlib> (stdlib.h)
<cstring> (string.h)
C++11
<ctgmath> (tgmath.h)
<ctime> (time.h)
C++11
<cuchar> (uchar.h)
<cwchar> (wchar.h)
<cwctype> (wctype.h)
容器
C++11
<array>
<deque>
C++11
<forward_list>
<list>
<map>
<queue>
<set>
<stack>
C++11
<unordered_map>
C++11
<unordered_set>
<vector>
輸入/輸出
<fstream>
<iomanip>
<ios>
<iosfwd>
<iostream>
<istream>
<ostream>
<sstream>
<streambuf>
多執行緒
C++11
<atomic>
C++11
<condition_variable>
C++11
<future>
C++11
<mutex>
C++11
<thread>
其他
<algorithm>
<bitset>
C++11
<chrono>
C++11
<codecvt>
<complex>
<exception>
<functional>
C++11
<initializer_list>
<iterator>
<limits>
<locale>
<memory>
<new>
<numeric>
C++11
<random>
C++11
<ratio>
C++11
<regex>
<stdexcept>
<string>
C++11
<system_error>
C++11
<tuple>
C++11
<type_traits>
C++11
<typeindex>
<typeinfo>
<utility>
<valarray>
<unordered_set>
C++11
unordered_multiset
C++11
unordered_set
unordered_multiset
C++11
unordered_multiset::~unordered_multiset
C++11
unordered_multiset::unordered_multiset
成員函式
C++11
unordered_multiset::begin
C++11
unordered_multiset::bucket
C++11
unordered_multiset::bucket_count
C++11
unordered_multiset::bucket_size
C++11
unordered_multiset::cbegin
C++11
unordered_multiset::cend
C++11
unordered_multiset::clear
C++11
unordered_multiset::count
C++11
unordered_multiset::emplace
C++11
unordered_multiset::emplace_hint
C++11
unordered_multiset::empty
C++11
unordered_multiset::end
C++11
unordered_multiset::equal_range
C++11
unordered_multiset::erase
C++11
unordered_multiset::find
C++11
unordered_multiset::get_allocator
C++11
unordered_multiset::hash_function
C++11
unordered_multiset::insert
C++11
unordered_multiset::key_eq
C++11
unordered_multiset::load_factor
C++11
unordered_multiset::max_bucket_count
C++11
unordered_multiset::max_load_factor
C++11
unordered_multiset::max_size
C++11
unordered_multiset::operator=
C++11
unordered_multiset::rehash
C++11
unordered_multiset::reserve
C++11
unordered_multiset::size
C++11
unordered_multiset::swap
非成員過載
C++11
運算子 (unordered_multiset)
C++11
swap (unordered_multiset)
參考
<unordered_set>
unordered_multiset
emplace_hint
public member function
<unordered_set>
std::
unordered_multiset
::emplace_hint
template <class... Args>iterator emplace_hint ( const_iterator position, Args&&... args );
帶提示構建並插入元素
在 unordered_multiset 中插入新元素。使用 args 作為元素建構函式的引數,在原地構造此新元素。
position
指向容器中的一個位置,該位置被建議作為搜尋插入點的提示(容器可能使用也可能不使用此建議來最佳化插入操作)。
這有效地使容器的 size 增加了 1。
有一個類似的成員函式 insert,它會複製或移動現有物件到容器中,並且也可以接受一個位置提示。
引數
position
作為插入操作的插入位置提示。該值可能被容器用來最佳化操作。
成員型別
const_iterator
是一個
forward iterator
型別。
args
傳遞給要插入的新元素的建構函式的引數。
返回值
指向新插入元素的迭代器。
成員型別
iterator
是一個
forward iterator
型別。
unordered_multiset
中的所有迭代器都對元素具有 const 訪問許可權:可以插入或移除元素,但在容器中不能修改它們。
新元素的儲存使用
allocator_traits<allocator_type>::construct()
分配,這在失敗時可能會丟擲異常(對於預設的
allocator
,
bad_alloc
如果分配請求不成功,則丟擲)。
示例
還沒有示例。請參閱 unordered_multiset::emplace 的示例。
複雜度
平均情況:常量。
最壞情況:容器大小的線性。
可能會強制執行
rehash
(未包含)。
迭代器有效性
在大多數情況下,插入後容器中的所有迭代器都保持有效。唯一的例外是當容器的增長強制重新雜湊時。在這種情況下,容器中的所有迭代器都將失效。
如果插入操作後新容器的大小會超過其容量閾值(計算方法為容器的 bucket_count 乘以其 max_load_factor),則會強制進行 rehash。
在所有情況下,即使在 rehash 之後,引用仍然保持有效。
另見
unordered_multiset::emplace
構造並插入元素
(公開成員函式)
unordered_multiset::insert
插入元素
(公開成員函式)