struct A { int a; bool operator>(const int& inty) { return a > inty; }}; template <class A, class B> auto operator<(const A& a, const B& b) -> decltype(operator>(a,b)) { return a < b; } int main(void) { A a; a.a = 1; int b = 2; operator<(a,b); return 0;}
Standard input is empty
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&)'
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!