How are std::list::iterators maintained/made?

Sep 6, 2009 at 9:36pm
I'm trying to understand how iterators work.

They are able to maintain list position even if the nodes beside it are removed. So I think it is more than a class with a prev/next nodes within the list.

Can anyone simply explain the contents of an iterator?

Also, if there is something better than std::list, I'd like to know about that too.
Sep 6, 2009 at 10:05pm

They are able to maintain list position even if the nodes beside it are removed.
- std::list leaves all the iterators pointing to the same locations after removing some of the list elements as it won't move anything else -


Here is a sample list iterator definition: http://www.cs.huji.ac.il/~etsman/Docs/gcc-3.4-base/libstdPython/html_user/stl__list_8h-source.html#l00111
Sep 6, 2009 at 10:33pm
Do professionals usually code like that? My eyes are bleeding. :[

Ok I think I understand, thanks for the implementation page. Looking through I realize I am better off writing my own implementation of stl::list.

Thanks.
Sep 6, 2009 at 11:27pm
Looking through I realize I am better off writing my own implementation of stl::list.


really ??
Sep 7, 2009 at 3:13am
Yea STL is weak in too many areas to make it worth using in a project - I started using it only because I was tight on time and had to push features to reach my milestones. I ended up being a few months early and decided I'm going to go through all my code and remove all stl from my project with some types I've written.

STL is so poor in certain areas that I am willing to go through 300 files (about 3mb in size of code) and remove all traces of it. It sucks that hard.
Sep 7, 2009 at 3:32am
All I can say is, enjoy your bugs.
Sep 7, 2009 at 9:20am
Wow, I had no problems with using the STL for at least 2 years in all my projects.
Sep 7, 2009 at 2:48pm
InLight: in what respect does the STL "suck"?

Topic archived. No new replies allowed.