Discover C++11. This is a new language standard, which has an improved syntax.
for (auto val : x) is a cycle in the collection x, the variable x will be copied to each item in the collection.
darrell answered on July 4th 19 at 22:56
The loop is equivalent to this:
for (auto val = x.begin(); val != x.end(); val++)
which is a loop using iterators
auto - automatic selection of the type of the variable. I do not recommend to abuse it.
Do not have.
Feature from C++11;