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