I try to write my compare function to use on map but it raised errors. Please help me, thanks a lot.
My code: https://ide.codingblocks.com/s/233622
User-defined compare function on C++ Map STL
@luchd,
C++ STL Map, only sorts on the basis of key value, not pair {key, value}, and thus expects a comparator of same type. Anyways, why are you using map, you can just use vector of pair and sorting.
@luchd,
Don’t use Map here, this is not a functionality of Maps. You are just over complicating a simple task.