When I do something like this:
int my_array[5] = {1, 2, 3, 4, 5};
for (int &x : my_array) {
x *= 2;
}
C++11 obviously knows that my array only has 5 elements. Is this information stored somewhere in the my_array object?
If so, is there any good reason why it is not made available to me as a developer (or is it?!?!?)? It seems that a lot of the world's problems would be solved if C++ devs always knew the bounds of the arrays they're dealing with.