Dela via


multimap::cend

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

const_iterator cend( ) const;

Return Value

A const bidirectional iterator that addresses the location succeeding the last element in a multimap Class. If the multimap is empty, then multimap::cend == multimap::begin.

Remarks

cend is used to test whether an iterator has reached the end of its multimap.

The value returned by cend should not be dereferenced.

Example

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

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

   multimap <int, int> :: const_iterator m1_cIter;
   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_cIter = m1.cend( );
   m1_cIter--;
   cout << "The value of last element of m1 is " 
        << m1_cIter -> second << endl;
}
The value of last element of m1 is 30

Requirements

Header: <map>

Namespace: std

See Also

Reference

multimap Class

Standard Template Library

Other Resources

multimap Members