Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class classT, typename ...method_arg_types>
- class func2;
- template<class classT, typename ...method_arg_types>
- func2<classT, method_arg_types...>
- func(classT *instance, void(classT::*method)(method_arg_types...))
- {
- return func2<classT, method_arg_types...>(instance, method);
- }
- template<class classT, typename ...method_arg_types>
- class func2 {
- friend func2<classT, method_arg_types...> func<classT, method_arg_types...>(classT *instance, void(classT::*method)(method_arg_types...));
- public:
- using method_type = void(classT::*)(method_arg_types...);
- func2(classT *instance, method_type method)
- : m_instance(instance), m_method(method)
- {
- }
- void operator()(method_arg_types&& ...method_args) {
- (m_instance->*m_method)(std::forward(method_args...));
- };
- private:
- method_type m_method;
- classT *m_instance;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement