fork(4) download
  1. #include <iostream>
  2. #include <type_traits>
  3. using namespace std;
  4.  
  5. // Declaration in the .h file
  6. class MyClass
  7. {
  8. public:
  9. template <class T> void function(T&& x) noexcept(std::is_nothrow_constructible<T>::value);
  10. };
  11.  
  12. // Definition in the .cpp file
  13. template <class T> void MyClass::function(T&& x) noexcept(std::is_nothrow_constructible<T>::value)
  14. {}
  15.  
  16. int main() {
  17. MyClass x;
  18. x.function(0);
  19. return 0;
  20. }
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty