Condividi tramite


map::crend

Restituisce un iteratore const destinato alla posizione che è l'ultimo elemento a mapping inverso.

const_reverse_iterator crend( ) const;

Valore restituito

Un iteratore bidirezionale di inversione const destinato alla posizione che è l'ultimo elemento a map Class inverso (la posizione che aveva precedente il primo elemento in mapunreversed).

Note

crend viene utilizzato con un mapping inverso come map::end viene utilizzato con map.

Tramite il valore restituito crend, l'oggetto map non può essere modificato.

crend può essere utilizzato per verificare se un iteratore inverso raggiunge la fine del map.

Il valore restituito da crend non è possibile dereferenziare.

Esempio

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

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

   map <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 map m1 is "
        << m1_crIter -> first << "." << endl;
}
  

Requisiti

intestazione: <map>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

map Class

Libreria di modelli standard