Jump to content
  • Advertisement
Sign in to follow this  
lincsimp

stl map question

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!