hash_multiset::const_reference

A type that provides a reference to a const element stored in a hash_multiset for reading and performing const operations.

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

Remarks

In Visual C++ .NET 2003, members of the <hash_map> and <hash_set> header files are no longer in the std namespace, but rather have been moved into the stdext namespace. See The stdext Namespace for more information.

Example

// hash_multiset_const_reference.cpp
// compile with: /EHsc
#define _DEFINE_DEPRECATED_HASH_CLASSES 0
#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 const_reference &Ref1 
   // to the 1st element
   const int &Ref1 = *hms1.begin( );

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

   // The following line would cause an error because the 
   // const_reference cannot be used to modify the hash_multiset
   // Ref1 = Ref1 + 5;
}

The first element in the hash_multiset is 10.

Requirements

Header: <hash_set>

Namespace: stdext

See Also

Concepts

hash_multiset Class

hash_multiset Members

Standard Template Library