itterate through a vector c++ code example
Example 1: iterate over vector in c++
for (auto & element : vector) {
element.doSomething ();
}
Example 2: c++ looping through a vector
vector<int> vi;
...
for(int i : vi)
cout << "i = " << i << endl;