By default, data in lists is sorted by key in ascending order, it often happens that this sort order needs to be changed.
To do this, you can write a comparator that will position the data as you specify.
An example of a comparator that sorts in descending order of the key (written before main):
struct cmp
{
bool operator()(const string &< /span>a, const string &b) const
{
return a > b;
}
};
and is used when creating the list:
map<string, int, cmp> ; mymap;