Advertisement Jump to content
Sign in to follow this  
lincsimp

stl map question

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

Advertisement
Couple of ways, you can use the index operator:

mymap[key]

the problem here is: if there is no element with the key "key" then it will create one with a default value.

mapiterator = mymap.find(key);

this will return an iterator to the entry with the key "key", or to mymap.end() should it not exist.

Share this post


Link to post
Share on other sites
Maps are sorted. Unless you added the elements in a sorted order, you can't access the n'th element inserted. You could iterate over the map to the n'th element in the map.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!