From: jwatts on
>
> Although this has historically been the case, I have been told that this
> is no longer the case. Compilers are now smart enough to see the
> equivalence and thereby generate equivalent code. It is my option at
> least for my own code that indices are more readable than pointers of
> iterators. I only use iterators for things such as std::list where I
> have no choice, and I never use std::list because std::vector tends to
> be faster. There may be cases where this is not true.
>
> --

I also used to find indices more readable, but after using iterators almost
exclusively for a couple of years, that no longer holds true.

As for compilers generating equivalent code, that hasn't been my personal
experience. The last time I benchmarked equivalent scenarios, iterators
and pointers were both substantially faster than indices, even on CPUs with
hardware math acceleration.

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]