Quote:Original post by davedx
It depends on what's in the iterators too, as demonstrated by the "list of ints" example.
A quick hint if you want to optimise STL: If you're using something like a vector, grab a pointer to the first element and use it like a pointer of pointers (array) in all your time critical sections of code. E.g.
not even useful, any decent compiler will render that code a useless optimization. Vector iterators ARE pointers in every sense of the word, and a compiler will convert them to the same code.
Quote:
Iterating through STL containers is pretty slow.
Iterating over a vector is the same as iterating over an array. Iterating over a list is slower, however it's a linked list. General statements like that are useless, and most often incorrect.