fork download
  1. #include <functional>
  2.  
  3. class event_manager
  4. {
  5. public:
  6. template <typename... T>
  7. static void register_event(const unsigned long , std::function<void(T...)> )
  8. {
  9. }
  10. };
  11.  
  12. int main()
  13. {
  14. event_manager::register_event<unsigned int>(12, [](unsigned int ) {});
  15. }
  16.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:73: error: no matching function for call to ‘event_manager::register_event(int, main()::__lambda0)’
     event_manager::register_event<unsigned int>(12, [](unsigned int ) {});
                                                                         ^
prog.cpp:14:73: note: candidate is:
prog.cpp:7:17: note: template<class ... T> static void event_manager::register_event(long unsigned int, std::function<void(T ...)>)
     static void register_event(const unsigned long , std::function<void(T...)> )
                 ^
prog.cpp:7:17: note:   template argument deduction/substitution failed:
prog.cpp:14:73: note:   ‘main()::__lambda0’ is not derived from ‘std::function<void(T ...)>’
     event_manager::register_event<unsigned int>(12, [](unsigned int ) {});
                                                                         ^
stdout
Standard output is empty