fork download
  1. #include <map>
  2.  
  3. using std::map;
  4.  
  5. struct map_data {
  6. int data1;
  7. int data2;
  8. };
  9.  
  10. struct map_data_comparator
  11. {
  12. bool operator()(const map_data& one, const map_data& two) const
  13. {
  14. if (one.data1 == two.data1)
  15. return one.data2 > two.data2;
  16. else
  17. return one.data1 < two.data1;
  18. }
  19. };
  20.  
  21. int main()
  22. {
  23. map<map_data, int, map_data_comparator> the_map;
  24. }
Success #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty