how to iterate through vector twice c++ code example
Example 1: c++ iterate over vector
for(auto const& value: a) {
/* std::cout << value; ... */
}
Example 2: c++ looping through a vector
for(std::vector<T>::size_type i = 0; i != v.size(); i++) {
v[i].doSomething();
}