Archived

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

STL multimaps

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

I''ve been searching around with google and have found very little info on multimaps. I understand the map concept well enough, and how multimaps allow duplicate keys, but I haven''t found anything on how to access data in multimaps. What I need to know is how to access the data in each of the keys matching whatever key I''m currently operating on.

Share this post


Link to post
Share on other sites
Your first port of call should be to the SGI STL documentation,and in particular their multimap page. That should tell you all that you need to know, if you read long enough. Basically you would use the equal_range function to get a pair of iterators to the relevant values, and iterate through them. A multimap element is a pair, where the .first element of that pair is the key and the .second element is the value. So your code will probably do something with ''myIterator->second'' while stepping myIterator through the range returned by equal_range.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Share this post


Link to post
Share on other sites