fork(3) download
  1. #include <iostream>
  2. #include <type_traits>
  3. using namespace std;
  4.  
  5. template <class T>
  6. class I
  7. {
  8. public:
  9. virtual auto write(const T&) -> typename std::enable_if<std::is_copy_constructible<T>::value>::type=0;
  10. };
  11.  
  12. template <class T>
  13. class J: public I<T>
  14. {
  15. public:
  16. auto write(const T& p) -> typename std::enable_if<std::is_copy_constructible<T>::value>::type {
  17. cout<<"write "<<p<<endl;
  18. };
  19. };
  20.  
  21.  
  22. int main() {
  23. J<int> x;
  24. x.write(5);
  25. //J<int&&> y;
  26. //y.write(10)
  27. return 0;
  28. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
write 5