You’re trying to pass a member function pointer as a normal function pointer which won’t work. Member functions have to have the this
pointer as one of the hidden parameters, which isn’t the case for normal functions, so their types are incompatible.
You can:
- Change the type of your argument to accept member functions and also accept an instance to be the invoking object
- Quit trying to pass a member function and pass a normal function (perhaps by making the function
static
) - Have a normal function that takes an instance of your class, a member function pointer, and a
std::string
and use something like boost’sbind
to bind the first two arguments - Make the callback registration function accept a functor object, or an
std::function
(I think that’s the name) - Numerous other ways which I won’t detail here, but you get the drift.