can i compare iterators to see if they point to the same object?

Started by
9 comments, last by Washu 19 years, 5 months ago
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.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

This topic is closed to new replies.

Advertisement