hash_multiset::value_type

备注

此 API 已过时。替代为 unordered_multiset 类

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

typedef Key value_type;

备注

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

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

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

在Visual C++ .NET 2003中,成员<hash_map><hash_set> 头文件不再在std命名空间,而是已经进入了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;
}
  

要求

Header: <hash_set>

**命名空间:**stdext

请参见

参考

hash_multiset 类

标准模板库