다음을 통해 공유


hash_set::crend

Note

This API is obsolete. The alternative is unordered_set Class.

Returns a const iterator that addresses the location succeeding the last element in a reversed hash_set.

const_reverse_iterator crend( ) const;

Return Value

A const reverse bidirectional iterator that addresses the location succeeding the last element in a reversed hash_set Class (the location that had preceded the first element in the unreversed hash_set).

Remarks

crend is used with a reversed hash_set just as hash_set::end is used with a hash_set.

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

crend can be used to test to whether a reverse iterator has reached the end of its hash_set.

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_crend.cpp
// compile with: /EHsc
#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.crend( );
   hs1_crIter--;
   cout << "The last element in the reversed hash_set is "
        << *hs1_crIter << "." << endl;
}
The last element in the reversed hash_set is 10.

Requirements

Header: <hash_set>

Namespace: stdext

See Also

Reference

hash_set Class

Standard Template Library