sorting with std::map

A

A. Saksena

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
 
D

David Harmon

On Wed, 2 Feb 2005 11:30:56 +0100 in comp.lang.c++, " A. Saksena"
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top