Archived

This topic is now archived and is closed to further replies.

Rolo Puentes

STL Performance

Recommended Posts

i need to traverse through a linked list, i''ve two choices, one using my own linked list implementation and another using the STL std::list. since iterating thru a linked list is so simple (just a mylist = mylist->next to go to the next element) do I have any processing overhead by using STL iterators? i''ve been trying to do some performance tests but the output was practically the same, does anybody know anything specific to this case? thanks

Share this post


Link to post
Share on other sites
STL iterators tend to have fairly simple behavior. And there''s not much you can do while iterating a linked list (other than iterate it), since STL does not perform bounds checking. Go ahead and use STL.



Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites
The good thing about using STL iterators with their list class is that you can still use the increment and decrement operators as if it were contiguous memory being iterated. And to access the object, you can simply defer the iterator! I guess you can say it''s almost like a pointer, that silly iterator.

Share this post


Link to post
Share on other sites