https://cpprefjp.github.io/lang/cpp11/range_based_for.html
std::vector<int> v;
for (std::vector<int>::const_iterator it = v.begin(), e = v.end(); it != e; ++it) {
  std::cout << *it << std::endl;
}
が
std::vector<int> v;
for (const auto& e : v) {
  std::cout << e << std::endl;
}
に置換できる。
注意点
範囲for文では要素をeraseすることができない。eraseしたい場合は、普通のfor文にする必要がある。
 
 
コメントを残す