fork download
  1. #include <iostream>
  2.  
  3. struct A {
  4. int a;
  5. bool operator<(const int& inty) { return a < inty; }
  6. bool operator>(const int& inty) { return a > inty; }
  7. };
  8.  
  9. template <class A, class B>
  10. auto operator<(const A& a, const B& b)
  11. -> decltype(a > b)
  12. { std::cout << "derp!\n"; return a < b; }
  13.  
  14. int main(void) {
  15. A a;
  16. a.a = 1;
  17. int b = 2;
  18. if (a < b)
  19. return 4;
  20. return 0;
  21. }
Runtime error #stdin #stdout 0s 2824KB
stdin
Standard input is empty
stdout
Standard output is empty