Udostępnij za pośrednictwem


map::cend

Zwraca const iteratora przeszłości końcowy.

const_iterator cend( ) const;

Wartość zwracana

Iteratora przeszłości końcowy.Jeśli map Class jest pusta, to map::cend() == map::begin().

Uwagi

cendSłuży do sprawdzania, czy iterację minął koniec jego map.

Wartość zwracana przez cend nie należy usunąć odwołania.

Przykład

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

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

   map <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 the last element of m1 is:\n" 
        << m1_cIter -> second << endl;
}
  

Wymagania

Nagłówek: <map>

Obszar nazw: std

Zobacz też

Informacje

map Class

Standardowa biblioteka szablonu