0
要通過C風格的多維數組迭代,我們有C++ 11多維數組迭代
int arr[3][4];
for (int row = 0; row < 3; row++){
for (int col = 0; col < 4; col++){
...
}
}
但是,如何可以一個使用迭代器遍歷如下:
array<array<int, 4>, 3> arr;
使用下面的迭代器?
array<array<int, 4>, 3>::iterator it1;
array<int, 4>::iterator it2;
11'(* IT2)= 0;'請 – peedurrr 2015-02-23 12:51:47
@peedurrr他們是沒有必要的,但我通常在括號中加上「指針解除引用」(運算符*(this)),以避免混淆和/或含糊不清。 – Marandil 2015-02-23 12:55:26