Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
A type that provides a reference to an element stored in a hash_set.
typedef list<typename Traits::value_type, typename Traits::allocator_type>::reference 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_set_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_set <int> hs1;
   hs1.insert( 10 );
   hs1.insert( 20 );
   // Declare and initialize a reference &Ref1 to the 1st element
   int &Ref1 = *hs1.begin( );
   cout << "The first element in the hash_set is "
        << Ref1 << "." << endl;
   // The value of the 1st element of the hash_set can be changed
   // by operating on its (non-const) reference
   Ref1 = Ref1 + 5;
   cout << "The first element in the hash_set is now "
        << *hs1.begin() << "." << endl;
}
The first element in the hash_set is 10. The first element in the hash_set is now 15.
Requirements
Header: <hash_set>
Namespace: stdext