Udostępnij za pośrednictwem


multimap::crend

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

const_reverse_iterator crend( ) const;

Return Value

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).

Remarks

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.

Example

// 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.

Requirements

Header: <map>

Namespace: std

See Also

Reference

multimap Class

Standard Template Library

Other Resources

multimap Members