I see a lot of c++ code that looks like this:
for( const_iterator it = list.begin(),
const_iterator ite = list.end();
it != ite; ++it)
<
Sample it under stress conditions and see if you're in ** this code very often ***.
If not, it doesn't matter.
If you are, look at the disassembly, or single-step it.
That's how you can tell which is faster.
You gotta be careful of these iterators.
They may get optimized into nice machine code, but often enough they don't, and become time hogs.
** (Where "in" means actually in it, or being called from it.)
*** (Where "often" means a significant percentage of the time.)
ADDED: Don't just see how many times per second the code is executed. It could be 1,000 times a second and still be using less than 1% of the time.
Don't time how long it takes either. It could take a millisecond and still be using less than 1% of the time.
You could multiply the two, to get a better idea, but that only works if they're not too skewed.
Sampling the call stack will tell you if it uses a high enough percentage of time to matter.