Given a pointer to an object and a pointer to a member function defined for that object's class, it's possible to call that function on that object. But, the syntax is torturous and it's easy to mess up:
((objectPtr)->*(memberFunctionPtr))();
So I thought I'd try my hand at writing a generic template function to make it easier. The code below seems to work for any class and any member function regardless of that function's return type. But it's only valid if the member function takes no arguments. Hence my question, can this be made more general with Variadic Parameters so that a member function that takes an arbitrary number of arguments (of arbitrary type) can be called?
Thanks.
Thanks, that is a lot simpler. I in fact was using a macro previously, but it was also only for functions with no parameters. I had forgotten about the "VA_ARGS" capability of macros.