Why is it impossible to define const and non-const variables in a single definition list ?
For example, when using a loop for:
for (size_t i = 0, const iCount = data.size(); i < iCount; ++i);
It would be better in terms of matching const-correctness, I think.
PS The first time I asked this question incorrectly. This is more for language developers, not why can it be compiled on my machine? . I wanted to say that it would be much better if it were implemented as syntactic sugar in the following C ++ standards. It will also prevent calls data.size()in each iteration of the loop. I mean, why not expand the current list of variable definitions for C ++ support const, and non-constin the same list of definitions?
source
share