hash_set::crbegin

Returns a const iterator addressing the first element in a reversed hash_set.

const_reverse_iterator crbegin( ) const;

Return Value

A const reverse bidirectional iterator addressing the first element in a reversed hash_set Class or addressing what had been the last element in the unreversed hash_set.

Remarks

crbegin is used with a reversed hash_set just as hash_set::begin is used with a hash_set.

With the return value of crbegin, the hash_set object cannot be modified.

crbegin can be used to iterate through a hash_set backwards.

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_crbegin.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;
   hash_set <int>::const_reverse_iterator hs1_crIter;

   hs1.insert( 10 );
   hs1.insert( 20 );
   hs1.insert( 30 );

   hs1_crIter = hs1.crbegin( );
   cout << "The first element in the reversed hash_set is "
        << *hs1_crIter << "." << endl;
}
The first element in the reversed hash_set is 30.

Requirements

Header: <hash_set>

Namespace: stdext

See Also

Reference

hash_set Class

Standard Template Library

Other Resources

hash_set Members