Given that I was passing the undefined function:
void foo(char, short);
I learned how to obtain the type tuple
of the arguments by calling decltype(m(foo))
with this function:
template <typename Ret, typename... Args>
tuple<Args...> m(Ret(Args...));
I would now like to pass an undefined method:
struct bar { void foo(char, short); };
I had tried rewriting m
like:
template <typename Ret, typename C, typename... Args>
tuple<Args...> m(Ret(C::*)(Args...));
But when I try to call this similarly with decltype(m(bar::foo))
I get the error:
invalid use of non-static member function
void bar::foo(char, short int)
How can I pass this method like I did for the function?
print_add
example: en.cppreference.com/w/cpp/utility/functional/function – Verdafunction
objects will not work, they need an address. Frankly I'm not even sure howdecltype(m(foo))
works, I'm just kinda going with it. – Subdelirium