Jump to content
  • Advertisement

Archived

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

quasar3d

std::list

This topic is 5383 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

say I have a list, and I retrieve an iterator to an item in that list. after that I add some more items to the list. now is that iterator still valid? My Site

Share this post


Link to post
Share on other sites
Advertisement
Hello quasar3d,

Technically no, but it could still be valid if you inserted at the end of the list.
If you were doing something with the list like process though it and then wanted to add sometime to it the insert return a iterator of new thin inserted and you can use that iterator as your new iterator.

Lord Bart

Share this post


Link to post
Share on other sites
thanx. I already thought that it should be possible, because there''s no reason it couldn''t be possible for a linked list, since the memory location of the actual items doesn''t change, only the references to the next and previous items, but I didn''t know for sure if the stl implementation did guarantee that

btw. volkerg, do you know that your name is almost the same as the name of the most hated person in the netherlands

My Site

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!