I'm trying to write a C++ function template f with one template parameter of type void (Foo::*FUNC)(T const *) where Foo is some class type. Furthermore, I would like to deduce T from the concrete member function pointer specified for FUNC. So one idea would be:
template<typename T, void(Foo::*FUNC)(T const *)>
void f()
{ /* use T in here, e.g. if constexpr (std::is_same_v<T, int>) */ }
But then I have to specify T explicitly when instantiating f and can't just write e.g. f<&Foo::bar>. I know there are ways to deduce the type of the first parameter of a function but they are all overly complicated (without using Boost). Is there a smarter way to do what i want?