Given that I passed the undefined function:
void foo(char, short);
I learned how to get the type of tuple arguments by calling decltype(m(foo)) with this function:
template <typename Ret, typename... Args> tuple<Args...> m(Ret(Args...));
Now I would like to pass the undefined method:
struct bar { void foo(char, short); };
I tried to rewrite m as:
template <typename Ret, typename C, typename... Args> tuple<Args...> m(Ret(C::*)(Args...));
But when I try to call it in the same way as decltype(m(bar::foo)) I get an error:
invalid use of non-static member function void bar::foo(char, short int)
How to pass this method, as I did for the function?
c ++ function methods expression member-function-pointers
Jonathan mee
source share