A for loop
for (inital; contition; after) {expression;}
expands to
inital;
while(condition)
{
expression;
after;
}
But what does a for-range loop (as below) expand to?
for(T &element : iterable) {expression;}
From what I have been able to find using a debugger, it looks something like
auto __for_range = iterable;
static_assert(std::forward_iterator<decltype(__for_range)>);
auto __for_begin = __for_range.begin();
auto __for_end = __for_range.end();
while (__for_begin < __for_end)
{
T &element = *_for_begin++;
expression;
}
But from testing that is not entirely the same. So, what does it expand to?