map::cend
Restituisce un iteratore di seguito a entità finale const.
const_iterator cend( ) const;
Valore restituito
Un iteratore di seguito a entità finale.Se map Class è vuoto, quindi map::cend() == map::begin().
Note
cend viene utilizzato per verificare se un iteratore ha superato la fine del map.
Il valore restituito da cend non è possibile dereferenziare.
Esempio
// 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;
}
Requisiti
intestazione: <map>
Spazio dei nomi: deviazione standard