I just changed job and my new company has a lot of code like this:
Code:
for(foo::iterator it = foobar.begin(); it != foobar.end(); ++it)
I always did it this way:
Code:
for(foo::iterator it = foobar.begin(), it_end = foobar.end(); it != it_end; ++it)
(Indirectly through a foreach macro of course)

The latter is quiet a bit faster. The only reason I can think of to do the former is if the loop changes what's in the container. Is there something I'm missing?