http://www.cprogramming.com/c++11/c++11-ranged-for-loop.html
有一个数组 int a[5] = {1, 2, 3, 4, 5};
以前要遍历方法如下:
for (int i = 0; i < sizeof(a); i++)
{
std::cout << a[i] << std::endl;
}
现在在C++ extension 11中新方法如下:
for (int i: a) {
std::cout << i << std::endl;
}
关于其它新功能: http://www.cprogramming.com/c++11/what-is-c++0x.html