Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

multimap::crend

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

const_reverse_iterator crend( ) const;

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

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

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

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

The value returned by crend should not be dereferenced.

// multimap_crend.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.crend( );
   m1_crIter--;
   cout << "The last element of the reversed multimap m1 is "
        << m1_crIter -> first << "." << endl;
}
The last element of the reversed multimap m1 is 1.

Header: <map>

Namespace: std

Show:
© 2015 Microsoft