You can't use member function pointers as normal function pointers, unless the member functions are static
. You should instead use Boost bind with a specific object instance:
boolConfigMap["USE_NEW_VERSION"] = boost::bind(&Config::useNewVersion, someInstanceOfConfig);
The reason that (non-static) member function pointers are not the same as normal function pointers (or static member function pointers) is that member functions have a hidden "zeroeth" argument, that is the this
pointer inside the member function.
Also, your declaration of the boost::function
objects should be only e.g.
boost::function<bool()>
That will handle all type of functions returning a bool
and taking no arguments.
If your compiler is new enough, you might also want to change to be using std::function
and std::bind
.
After your edit to show with member function pointers: You have to call the function pointers correctly as well, like
(config.*configIter->second)();