Compartir a través de


hash_map::crbegin

Note

This API is obsolete. The alternative is unordered_map Class.

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

const_reverse_iterator crbegin( ) const;

Return Value

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

Remarks

crbegin is used with a reversed hash_map just as begin is used with a hash_map.

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

crbegin can be used to iterate through a hash_map 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_map_crbegin.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_map <int, int> hm1;

   hash_map <int, int> :: const_reverse_iterator hm1_crIter;
   typedef pair <int, int> Int_Pair;

   hm1.insert ( Int_Pair ( 3, 30 ) );

   hm1_crIter = hm1.crbegin( );
   cout << "The first element of the reversed hash_map hm1 is "
        << hm1_crIter -> first << "." << endl;
}
The first element of the reversed hash_map hm1 is 3.

Requirements

Header: <hash_map>

Namespace: stdext

See Also

Reference

hash_map Class

Standard Template Library