I have defined a map<string, int> where string are words and int are how many times they appear in a textfile.
Now I want to sort the according to descending order of it's frequency. I now for this I have to write my own comparison function, which will be use in sort.
But I am finding difficulty in this So I need help.... Thanks in advance
If you want a container in which you want to be able to sort on both key and value, the right container is a boost::multi_index_container. However, boost isn't for the faint of heart, and if this for a school project, then do as jtsaur said.