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) { return a < b; }
  7.  
  8. int main(void) {
  9. A a; a.a = 1;
  10. int b = 2;
  11. if (a < b) return 4;
  12. return 0;
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:11:11: error: no match for 'operator<' in 'a < b'
stdout
Standard output is empty