fork download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. class A {
  5. public:
  6. A() {}
  7. A(const A&) {}
  8. A(int) {}
  9. };
  10.  
  11. class B{};
  12.  
  13. template<typename T>
  14. typename std::enable_if
  15. < std::is_base_of<A, T>::value
  16. , A >::type
  17. operator+(T& lhs,int rhs){
  18. typename std::enable_if
  19. < std::is_base_of<A, T>::value
  20. , A >::type ret;
  21. // stuff
  22. return ret;
  23. }
  24.  
  25. int main() {
  26. A u;
  27. A v = u+1;
  28. }
  29.  
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty