array::cbegin
Restituisce un iteratore di accesso casuale const al primo elemento nel contenitore.
const_iterator cbegin() const;
Valore restituito
Un iteratore di accesso casuale const destinato al primo elemento in array Class (TR1) o in cui viene arrayvuoto.È necessario confrontare sempre il valore restituito da array::cend o array::end per garantire che sia valido.
Note
Tramite il valore restituito array::cbegin, l'oggetto array non può essere modificato.
Esempio
// array_cbegin.cpp
// compile with: /EHsc
#include <array>
#include <iostream>
int main()
{
using namespace std;
array<int, 2> c1 = {1, 2};
array<int, 2>::const_iterator c1_Iter;
cout << "The array c1 contains elements:";
c1_Iter = c1.cbegin();
for (; c1_Iter != c1.cend(); c1_Iter++)
{
cout << " " << *c1_Iter;
}
cout << endl;
// The following line would be an error because iterator is const
// *c1.cbegin() = 200;
}
Requisiti
intestazione: <array>
Spazio dei nomi: deviazione standard