fork download
  1. #include <iostream>
  2. #include <utility>
  3. #include <functional>
  4. using namespace std;
  5.  
  6. template <typename T>
  7. struct TypeInfo
  8. {
  9. T t;
  10. enum {
  11. IsNothrowMoveConstructible = noexcept(T(std::move(t)))
  12. };
  13. bool test()//enum
  14. {
  15. T t;
  16. bool val = noexcept(T(std::move(t)));
  17. return val;
  18. };
  19. };
  20.  
  21. struct U{};
  22. struct V{
  23. V(){}
  24. V(V&& x) noexcept{}
  25. };
  26.  
  27. int main() {
  28. TypeInfo <U> u;
  29. TypeInfo <V> v;
  30. std::cout<<u.test()<<" "<<v.test()<<std::endl;
  31. return 0;
  32. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
1 1