次の方法で共有


hash_multiset::value_type

[!メモ]

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

要素として値として、容量がhash_multisetとして格納されているオブジェクトを表す型。

typedef Key value_type;

解説

value_typeKeyは、テンプレート パラメーターのシノニムです。

Keyの詳細については、hash_multiset Class のトピックの"解説"を参照してください。

key_typevalue_type の両方がテンプレート パラメーターのシノニム **[キー]**であることに注意してください。どちらの型も明確な、クラスのhash_mapとhash_multimapとの互換性のために、同一であるクラスのhash_setとhash_multisetに提供されます。

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

使用例

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

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_multiset <int> hms1;
   hash_multiset <int>::iterator hms1_Iter;

   // Declare value_type
   hash_multiset <int> :: value_type hmsvt_Int; 

   hmsvt_Int = 10;   // Initialize value_type

   // Declare key_type
   hash_multiset <int> :: key_type hmskt_Int;
   hmskt_Int = 20;             // Initialize key_type

   hms1.insert( hmsvt_Int );         // Insert value into s1
   hms1.insert( hmskt_Int );         // Insert key into s1

   // A hash_multiset accepts key_types or value_types as elements
   cout << "The hash_multiset has elements:";
   for ( hms1_Iter = hms1.begin() ; hms1_Iter != hms1.end( );
         hms1_Iter++)
      cout << " " << *hms1_Iter;
      cout << "." << endl;
}
  

必要条件

ヘッダー: <hash_set>

名前空間: のstdext

参照

関連項目

hash_multiset Class

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