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