备注
此 API 已过时。替代为 unordered_multiset 类。
插入元素构造就地到 hash_multiset,与位置提示。
template<class ValTy>
iterator insert(
const_iterator _Where,
ValTy&& _Val
);
参数
参数 |
说明 |
_Val |
待插入hash_multiset 类的元素的值,除非hash_multiset已经包含该元素,通常,一个元素的键是相同排序的。 |
_Where |
开始搜索正确的插入点的位置。(假如插入点紧跟_Where,插入将发生在常量级时间内而不出逻辑时间内)。 |
返回值
hash_multiset::emplace 成员函数返回指向新位置的元素插入 hash_multiset的迭代器。
备注
如果插入点位紧跟 _Where,则插入在、的常量时发生,而不是对数时间。
在Visual C++ .NET 2003中,成员<hash_map> 和 <hash_set> 头文件不再在std命名空间,而是已经进入了stdext命名空间。 有关更多信息,请参见 stdext 命名空间。
示例
// hash_multiset_emplace_hint.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
#include <string>
int main( )
{
using namespace std;
using namespace stdext;
hash_multiset<string> hms1;
string str1("a");
hms1.insert(hms1.begin(), move(str1));
cout << "After the emplace insertion, hms1 contains "
<< *hms1.begin() << "." << endl;
}
要求
Header: <hash_set>
**命名空间:**stdext