I am trying to get the number of parameters in a class member function.
template <typename R, typename ... Types>
constexpr std::integral_constant<unsigned, sizeof ...(Types)>
FuncArgCount(R(*f)(Types ...))
{
return std::integral_constant<unsigned, sizeof ...(Types)>{};
}
class TestClass
{
public:
TestClass(){}
void On_Test(size_t v)
{}
void Call()
{
std::cout<< FuncArgCount(&TestClass::On_Test)::value;
}
};
The above template implementation is taken from this thread and works great on non-member functions Get function parameters count