Is there an equivalent to the range-based enumerate
loop from python in C++?
I would imagine something like this.
enumerateLoop (auto counter, a
Enumeration of multiple variables has been an idiom since C. The only complication is that you can't declare both variables in the initializer of the for loop.
int index;
for (auto p = container.begin(), index = 0; p != container.end(); ++p, ++index)
I don't think it gets any simpler (or more powerful) than that.