loop through vector cpp code example
Example 1: c++ iterate over vector
for(auto const& value: a) {
/* std::cout << value; ... */
}
Example 2: iterate over vector in c++
for (auto & element : vector) {
element.doSomething ();
}
for(auto const& value: a) {
/* std::cout << value; ... */
}
for (auto & element : vector) {
element.doSomething ();
}