hash_multimap::emplace_hint

说明说明

此 API 已过时。另一种方法是 unordered_multimap Class

插入构造的元素就地到一 hash_multimap 中,具有位置提示。

template<class ValTy>
    iterator emplace_hint(
        const_iterator _Where,
        ValTy&& _Val
);

参数

Parameter

描述

_Val

用于的值将构造要插入的元素。hash_multimap Class,除非 hash_multimap 已包含该元素 (或,通常,键相同地排序) 的元素。

_Where

有关起始位置的提示搜索正确位置插入。

返回值

hash_multimap::emplace 成员函数返回指向位置新元素插入 hash_multimap的迭代器。

备注

元素的 hash_multimap::value_type 是对,因此,元素的值将排序的匹配的第一个元素等于键值和第二个元素为等于元素的数据值。

如果插入点紧跟在 _Where,在将能够的常量时发生,而不是对数时间。

从 Visual C++ .NET 2003 中启动,<hash_map><hash_set> 标头文件的成员中不再标准,命名空间,而是将 stdext 命名空间。有关更多信息,请参见 stdext 命名空间

示例

// hash_multimap_emplace_hint.cpp
// compile with: /EHsc
#include<hash_multimap>
#include<iostream>
#include <string>

int main()
{
    using namespace std;
    using namespace stdext;
    hash_multimap<int, string> hm1;
    typedef pair<int, string> is1(1, "a");

    hm1.emplace(hm1.begin(), move(is1));
    cout << "After the emplace insertion, hm1 contains:" << endl
      << " " << hm1.begin()->first
      << " => " << hm1.begin()->second
      << endl;
}
  

要求

标头: <hash_map>

命名空间: stdext

请参见

参考

hash_multimap Class

标准模板库