Jump to content

C++ Language/ProgramFlow/Loops/LoopingOverCollection

From Wikibooks, open books for an open world

Any STL collection that provides iterators via begin() and end() (e.g., std::vector<int> veciVar = {0,11,22,33};) can be iterated by for (int iItem : veciVar) { body }.

Additional information about looping over a collection (includes interactive examples)