Sign in to follow this  

question about std::hash_map

This topic is 4729 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

hi, does anyone know if a std::hash_map has the same property of a std::set and std::map in that all pointers and iterators to items in the container will always remain valid, unless of course they are erased from the map? i cant find any mention of this in the STL docs (yes i know that hash map is only an extension). thanks for any help.

Share this post


Link to post
Share on other sites
After reading various stl references from SGI, it seems that when iterators are not invalidated, it is explictly mentioned in the reference (see map, set, list), and when they can be invalidated it is not mentioned (see vector).

Since the non-invalidation of iterators is not mentioned for the hash_map, I can only assume they could be invalidated by deletion or insertion (although that does not mean they will be, but don't play with fire if you want to keep your limbs attached).

Share this post


Link to post
Share on other sites

This topic is 4729 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this