I have a function that takes a pointer to a member function (along with the necessary arguments) and calls the function on a class instance. Is there a way to not have to pass the default arguments or somehow get their value? (Ignore the static instance)
class X
{
public:
void func(int p = 10);
}
static X x;
template <typename... Args>
void call(void (X::* f)(Args...), Args... args)
{
// do something
(x.*f)(args...);
// do something
}
void main()
{
call(&X::func); //doesn't compile
call(&X::func, 10); //have to know the default argument for this
}
I'm trying to replace this macro
#define CALL(...) \
{ \
// some setup \
__VA_ARGS__ \
//some cleanup \
}
static X x;
void main()
{
CALL(x.func();)
}