iterate over all elements in vector c++ code example Example: iterate over vector in c++ for (auto & element : vector) { element.doSomething (); }