lundi 23 février 2015

C++11 Multidimentional Array Iteration

To iterate through a C style multidimentional array we have



int arr[3][4];

for (int row = 0; row < 3; row++){
for (int col = 0; col < 4; col++){
...
}
}


But how may one use iterators to iterate over the following:



array<array<int, 4>, 3> arr;


Using the following iterators?



array<array<int, 4>, 3>::iterator it1;

array<int, 4>::iterator it2;

Aucun commentaire:

Enregistrer un commentaire