Advice on iterator vs. index efficiency

me22 me22.ca@gmail.com
Sun Oct 7 02:19:00 GMT 2007


On 06/10/2007, Neal Becker <ndbecker2@gmail.com> wrote:
> I was wondering if gcc would see that the index version is just incrementing
> through, and avoid the nested index calculations.  This seems to be
> supported by your statement that they generate the same code.

For a vector I'm confident that it does do something.  I was thinking
more for something like deque, where, while O(1), operator[] is more
than a simple addition.

~ Scott



More information about the Gcc-help mailing list