stl vector iteration code example
Example 1: c++ vector iterator
#include <iostream>
#include <vector>
using namespace std;
vector<int> myvector;
for (vector<int>::iterator it = myvector.begin();
it != myvector.end();
++it)
cout << ' ' << *it;
cout << '\n';
Example 2: iterate over vector in c++
for (auto & element : vector) {
element.doSomething ();
}