By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,797 Members | 1,836 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,797 IT Pros & Developers. It's quick & easy.

sorting with std::map

P: n/a
Hi guys,
Question regrading std::map. If I have a std::map like
std::map < unsigned int, SOME_USER_DEFINED_DATA_TYPE > request_map;
how I can sort this request_map for given value of unsigned int.
I have a understanding that STL sort algorithm cannot be used with a
associative containers like map.Is there is any other way?

Abhishek
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Wed, 2 Feb 2005 11:30:56 +0100 in comp.lang.c++, " A. Saksena"
<ab**************@philips.com> wrote,
Hi guys,
Question regrading std::map. If I have a std::map like
std::map < unsigned int, SOME_USER_DEFINED_DATA_TYPE > request_map;
how I can sort this request_map for given value of unsigned int.


A std::map always sorts itself according to the predicate you created
it with (default std::less<T>). It's speedy key lookup depends on
that. You cannot sort it differently later.

What does "sort for a given value" mean, anyway?

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.