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