I have a caller function like this:
template
void CallMethod(T *object){
(object->*method)(args);
}
All template parameters must be known at compile time. So if method
is really a variable and not a particular function, there is no way to do what you want.
Instead, you may be able to make a template struct
which has a pointer to member function as a member and implements an operator()
which acts similarly to CallMethod
.