How can I implement STL map sorting by value?
For example, I have a map m:
m
map m; m[1] = 10; m[2] = 5; m[4] = 6; m[6] =
Create another map, provide a less() function based on the value not key, AND the function should return true if the value1 <= value2 (not strictly < ). In this case, elements with non-distinct values can be sorted as well.