>>40
Yes, compiler optimizes it in case of ints, pointers, etc. So you can write i++; or ++i; And we were used to that in C.
But in C++ you do it to iterators, and suddenly
for(vector<int> iterator it = v.begin(); it != v.end(); it++)
is worse than
for(vector<int> iterator it = v.begin(); it != v.end(); ++it)
because, as
>>42 said, compiler doesn't know if ++it works exactly like it++, so it creates a NEW FUCKING COPY (then destroys it) of the iterator EVERY TIME it's incremented.
All because
for is such a low-level construction.
A little
foreach construct wouldn't hurt. But it certainly won't solve all of C++'s problems, and knowing it, will introduce some more.