fork download
  1. struct A {
  2. int a;
  3. bool operator>(const int& inty) { return a > inty; }
  4. };
  5.  
  6. template <class A, class B> auto operator<(const A& a, const B& b) -> decltype(a>b)
  7. { return a < b; }
  8.  
  9. int main(void) {
  10. A a; a.a = 1;
  11. int b = 2;
  12. if (a < b)
  13. return 4;
  14. return 0;
  15. }
  16.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:12:10: error: no match for 'operator<' in 'a < b'
stdout
Standard output is empty