fork download
  1. #include <vector>
  2. #include <set>
  3.  
  4. #include <algorithm>
  5.  
  6. struct point // A simple custom point structure
  7. {
  8. int x, y;
  9. };
  10.  
  11. // Operator created by the wizard
  12. // --------------------------------------------------
  13.  
  14. inline bool operator< (const point &left, const point &right)
  15. {
  16. if (left.x == right.x)
  17. return (left.y < right.y);
  18. else
  19. return (left.x < right.x);
  20. }
  21.  
  22. // --------------------------------------------------
  23.  
  24. int main()
  25. {
  26. std::vector<point> v;
  27. std::sort(v.begin(), v.end()); //Compiles happily with point structures
  28.  
  29. std::set<point> s;
  30. s.find(point()); //Compiles happily with point structures
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty