for(auto const& value: a) {
/* std::cout << value; ... */
}
for (int i = 0; i < Vector.size(); i++)
{
type Element = Vector[i];
}
for(int i = 0; i < vec.size(); i++){
cout << vec[i] << endl;
}
for (auto & element : vector) {
element.doSomething ();
}
for(auto i = begin(vec); i != end(vec); i++){
cout << *i << endl;
}
}
// Using a for loop with iterator
for(std::vector<int>::iterator it = std::begin(v); it != std::end(v); ++it) {
std::cout << *it << "
";
}