multimap::crbegin

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

const_reverse_iterator crbegin( ) const;

Return Value

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

Remarks

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

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

crbegin can be used to iterate through a multimap backwards.

Example

// multimap_crbegin.cpp
// compile with: /EHsc
#include <map>
#include <iostream>

int main( )
{
   using namespace std;
   multimap <int, int> m1;

   multimap <int, int> :: const_reverse_iterator m1_crIter;
   typedef pair <int, int> Int_Pair;

   m1.insert ( Int_Pair ( 1, 10 ) );
   m1.insert ( Int_Pair ( 2, 20 ) );
   m1.insert ( Int_Pair ( 3, 30 ) );

   m1_crIter = m1.crbegin( );
   cout << "The first element of the reversed multimap m1 is "
        << m1_crIter -> first << "." << endl;
}
The first element of the reversed multimap m1 is 3.

Requirements

Header: <map>

Namespace: std

See Also

Reference

multimap Class

Standard Template Library

Other Resources

multimap Members