Why it is not possible to define const and non-const variables in one definition list?
For example, in using for
loop:
for (size_t i = 0, const iCount = data.size(); i < iCount; ++i);
It would be better from const-correctness viewpoint I guess.
P.S. I've asked this question wrong at first time. It is more for language designers rather than "why it can be compiled on my machine?". I wanted to say that this would be much better if it would be implemented as syntax sugar in next C++ standards. Also this will prevent calls of data.size()
in each loop iteration. I mean, why not to extent current C++ variable definition list to support const
and non-const
in single definition list?