Hi All,
Does anyone know that is there a way that I can change the map order from less to kind of "more"?
For example:
There is a map<string, int> called test
test["b"] = 1;
test["a"] = 3;
test["c"] = 2;
Inside the map, the order will be
(a, 3)
(b, 1)
(c, 2).
I want it to be
(c, 2)
(b, 1)
(a, 3).
How can I do that in a easy way? Please anyone who knows that tell me how.
Cheers,
A_ traverse it backwards (reverse iterators)
1_ use the third template argument, by instance std::greater
\alpha_ don't care
Last edited on
@ne555 Thank you for your answer, the second method. That's what I exactly need :)
Thank you @LowestOne as well.