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