Condividi tramite


map::cbegin

Restituisce un iteratore const destinato al primo elemento nella mappa.

const_iterator cbegin( ) const; 

Valore restituito

Un iteratore bidirezionale const destinato al primo elemento in map Class o la posizione che ha mapvuoto.

Commento

Tramite il valore restituito cbegin, gli elementi nell'oggetto map non possono essere modificati.

Esempio

// map_cbegin.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 ( 0, 0 ) );
   m1.insert ( Int_Pair ( 1, 1 ) );
   m1.insert ( Int_Pair ( 2, 4 ) );

   m1_cIter = m1.cbegin ( );
   cout << "The first element of m1 is " << m1_cIter -> first << endl;
   }
  

Requisiti

intestazione: <map>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

map Class

Libreria di modelli standard