-
Map
I use maps...But i wanted the map to be sorted in decreasing order of the key value... wat spiece of code should i add to change the comparator to the following
Code:
multimap<double,long long int> mymap;
multimap<double,long long int>::iterator it;
-
The third template parameter to (multi)map is the comparison object. You can use std::greater.
-
S i know that third is its keycomparator...but i am not sure of gthe way to add it in the code...It gives me error...
can u just give me the snippet of how the declaration would look like
-
Off the top of my head, it's probably
Code:
std::multimap<type_key, type_value, std::greater<type> >
-
Are you sure you even need to do that?
You can iterate over the container from rbegin() to rend(), which might be enough in your circumstances.