Skip to main content
gamedev.net
🔒 Locked

question about std::hash_map

Started by graveyard filla Jan 1, 2005 at 2:57 PM 1 replies 450+ views
Original Post
graveyard filla
graveyard filla
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.
FTA, my 2D futuristic action MMORPG
ToohrVyk
ToohrVyk
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).
DukeAtreides076
DukeAtreides076
IIRC hash_map is NOT part of the C++ standard, so check the docs on the implementation you are using.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.