Hi,

a basic question how do i sort my map by value:

example


Code:
map<int, int> m;
m[1] = 10;
m[3] = 10;
m[6] = 5;
m[12] = 14;
what i need is :



Code:
m[12] = 14;
m[3] = 10;
m[1] = 10;
m[5] = 6;
so if i have duplicate values then key order should be considered. well i'll figure out the key order latter, for now i would appreciate some basic help with value order. I mean i could first copy the values int a vector and the sort the vector and then reassign key values but that sounds complicated. is there a faster (or at least a simpler ) way to do this. all i need to know is the order of keys give the values are sorted (biggest to smallest)

thnx