次の方法で共有


hash_set::emplace_hint

[!メモ]

この API は、互換性のために残されています。代わりに unordered_set クラスです。

hash_setに構築された要素を挿入します。

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

パラメーター

パラメーター

説明

_Val

hash_set が既にその要素をか、キーが同じで並べる要素をよりよくある場合 hash_set Class に挿入する要素の値。

_Where

挿入の正しいポイントの検索を開始する位置。(挿入に対数の時間ではなく償却定数時間で挿入位置がの _Whereに従うと、生成される場合があります)。

戻り値

hash_set::emplace のメンバー関数は、新しい要素を挿入 hash_setに、または場所で同じ大小関係を使用して既存の要素が出現位置を指す反復子を返します。

解説

挿入は対数の時間ではなく償却定数時間で挿入位置がの _Whereする場合は、発生することがあります。

Visual C++ .NET 2003では、<hash_map><hash_set> ヘッダー ファイルのメンバーはstdの名前空間に存在しなくなりましたが、ではなくstdextの名前空間に型。詳細については、「The stdext Namespace」を参照してください。

使用例

// hash_set_emplace_hint.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
#include <string>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_set<string> hs3;
   string str1("a");

   hs3.insert(hs3.begin(), move(str1));
   cout << "After the emplace insertion, hs3 contains "
      << *hs3.begin() << "." << endl;
}
  

必要条件

ヘッダー: <hash_set>

名前空間: のstdext

参照

関連項目

hash_set Class

標準テンプレート ライブラリ