fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3. template<class S> class Foo;
  4.  
  5. template<class Ret, class Arg, class... Args>
  6. class Foo<Ret(Arg*, Args...)>
  7. {
  8. public:
  9. template<class FUNC>
  10. Foo(FUNC func, int)
  11. {
  12. cout << "func" << endl;
  13. }
  14. template<class Rett>
  15. Foo(Rett(Arg::*method)(Args...)) { cout << "fptr" << endl; }
  16.  
  17. };
  18.  
  19. void Bar(int*, int)
  20. {
  21.  
  22. }
  23.  
  24. int main()
  25. {
  26.  
  27. Foo<void(int*, int)> fff(&Bar, 1);
  28.  
  29. return 0;
  30. }
  31.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of 'class Foo<void(int*, int)>':
prog.cpp:27:26:   required from here
prog.cpp:15:2: error: creating pointer to member function of non-class type 'int'
  Foo(Rett(Arg::*method)(Args...)) { cout << "fptr" << endl; }
  ^
stdout
Standard output is empty