c++ looping through a vector

C++
for(std::vector<T>::size_type i = 0; i != v.size(); i++) {
    v[i].doSomething();
}vector<int> vi;
...
for(int i : vi) 
  cout << "i = " << i << endl;
Source

Also in C++: