Range-based for ( : )
Iterates over array/vector elements.
Syntax
for (type e : collection) { }Description
Iterates over elements without dealing with indices (C++11+).
Example
Loading editor…
Expected output
10 20 30
When to use?
Iterating collections.