次の方法で共有


hash_multiset::reference

[!メモ]

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

要素への参照を提供する型はhash_multisetに格納されている

typedef list<typename _Traits::value_type, typename _Traits::allocator_type>::reference reference;

解説

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

使用例

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

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

   hms1.insert( 10 );
   hms1.insert( 20 );

   // Declare and initialize a reference &Ref1 to the 1st element
   int &Ref1 = *hms1.begin( );

   cout << "The first element in the hash_multiset is "
        << Ref1 << "." << endl;

   // The value of the 1st element of the hash_multiset can be
   // changed by operating on its (non const) reference
   Ref1 = Ref1 + 5;

   cout << "The first element in the hash_multiset is now "
        << *hms1.begin() << "." << endl;
}
  
  

必要条件

ヘッダー: <hash_set>

名前空間: のstdext

参照

関連項目

hash_multiset Class

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