From C++ Primer 5th Edition by Lippman, page 182, consider:
int ia[3][4];
for (auto row : ia)
for (auto col : row)
The first
foriterates through ia, whose elements are arrays of size 4. Becauserowis not a reference, when the compiler initializesrowit will convert each array element (like any other object of array type) to a pointer to that array’s first element. As a result, in this loop the type ofrowisint*.
I am not really sure that I understand how this auto works, but if I can assume it automatically gives a type to a row based on ia array members type, but I don't understand why this kind of for, where row is not a reference, is not valid. Why is this going to happen? "pointer to that array’s first element", because of what?