Consider this snippet:
#include <iostream>
int main() {
int s[6] {0, 1, 2, 3, 4, 5};
for ( auto && i: s ) {
std::cout << " " << i << std::endl;
}
}
This compiles and runs happily both under g++ and clang++.
It is taken for granted in many posts(here and here, for example), but it is unclear to me how the compiler can correctly infer the size of the array in the for range
for a type without iterator.
Can anyone answer or add a link to the reference?