for vector c++ code example
Example 1: for vector c++
for (auto it = begin (vector); it != end (vector); ++it) {
it->doSomething ();
}
Example 2: for vector c++
std::vector<int>::iterator it = vector.begin();
Example 3: for vector c++
vector<int> vi;
...
for(int i : vi)
cout << "i = " << i << endl;