hash_multiset::value_type

说明说明

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

描述为 hash_multiset 存储化为元素的对象作为其值的类型。

typedef Key value_type;

备注

value_type 是模板参数的 Key同义词。

有关 Key的更多信息,请参见 hash_multiset Class 主题的"备注"节。

请注意 key_typevalue_type 是模板参数的 同义词。两个类型为选件类 hash_set 和 hash_multiset 提供,它们用于选件类 hash_map 和 hash_multimap 的兼容性是相同的,因此,它们是不同的。

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

示例

// 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

标准模板库