fork(3) download
  1. #include <algorithm>
  2. #include <functional>
  3. #include <iostream>
  4. #include <memory>
  5. #include <string>
  6. #include <type_traits>
  7. #include <utility>
  8.  
  9. namespace A {
  10. namespace B {
  11. namespace C {
  12. namespace D {
  13. template <class T>
  14. struct point_xy { T x, y; point_xy(T x, T y) : x(x), y(y) {} };
  15. }
  16. }
  17. }
  18. }
  19.  
  20. typedef A::B::C::D::point_xy<long> Point;
  21. typedef std::pair<Point, Point> Vector;
  22.  
  23. namespace A { namespace B { namespace C { namespace D {
  24. bool operator==(const Point& p1, const Point& p2) {
  25. return p1.x== p2.x && p1.y== p2.y;
  26. }
  27. } } } }
  28.  
  29. int main() {
  30. Vector vec1(Point(0,0), Point(1,1));
  31. Vector vec2(Point(0,0), Point(1,2));
  32. std::cout << ((vec1 == vec2) == false) << std::endl;
  33. std::cout << ((vec1 == vec1) == true) << std::endl;
  34. }
  35.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1
1