fork download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <ostream>
  4. #include <set>
  5.  
  6. struct Point : std::pair<int, int> {
  7.  
  8. using pair<int, int>::pair;
  9. };
  10.  
  11. std::ostream& operator<<(std::ostream& o, const Point& p) {
  12. return o << p.first << ' ' << p.second;
  13. }
  14.  
  15.  
  16. int main()
  17. {
  18. std::set<Point> s;
  19. s.insert( Point(2,2) );
  20. s.insert( Point(3,3) );
  21. s.insert( Point(2,3) );
  22. s.insert( Point(4,4) );
  23. std::copy(s.begin(), s.end(), std::ostream_iterator<Point>(std::cout, "\n"));
  24. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
2 2
2 3
3 3
4 4