C++11 range for loops with the auto keyword (type deduction).camsr wrote:I'm not familiar with this construct, can you elaborate how it works?Miles1981 wrote: Which why in modern C++, you write it like this:Code: Select all
for (auto item: list) { doSomethingWith(item); }
As long as std::begin(list) and std::end(list) works, you can create this. You can also use auto& if you want to modify the object in place or const auto& if the object is costly to copy.