map container question

Thank you. Zhuge. I will try the ">" overload.
But my question is the syntax. I would word the question differently.
By default, map container has the elements sorted in ascending order.

std::map<int, std::string, std::greater<int> > will sort the element in
descending order. But If I use class type as the key, what would be the syntax be? Some thing like

std::map<int, std::string, greater<key_class> > ?






Last edited on
You should look up operator overloading and overload the > operator for your key_c class.
Yes. it works after ">" overload. Also the syntax is

std::map<int, std::string, std::greater<key_class> >

Many thanks for the help.
Topic archived. No new replies allowed.