Assuming I have a pointer to a member function, how can I write code that automatically outputs the parameters for the given signature of the template:
template<typename T> class Foo {}; template<typename R, typename C, typename... A> class Foo<R(C, A...)> { };
There is no problem for C and R, since something like this does the trick:
template<typename R, typename C, typename... A> R deduce_R_type(R(C::*)(A...)); template<typename R, typename C, typename... A> C deduce_C_type(R(C::*)(A...));
Then I can connect it to the Foo instance, but how to deduce the types coming from the variational part of the template?
Foo< decltype(deduce_R_type(&SomeClass::SomeFunction)) ( decltype(deduce_C_type(&SomeClass::SomeFunction)), ___ ??? ___)> instance
c ++ c ++ 11 templates decltype variadic-templates
Adrian lis
source share