I would like to do something like
template<typename InstanceType>
void add_test(void (InstanceType::* test_method )(void*),
std::tr1::shared_ptr<InstanceType> user_test_case)
{
boost::function<void ()> op;
op = boost::bind<InstanceType>(test_method, *user_test_case);
But it says:
1>d:\boost\boost/bind/mem_fn.hpp(359): error: a pointer to a bound function may only be used to call the function
1> return (t.*f_);
What is wrong here?
bind
is the return type. So, it should be void
. Or just omit it.boost::function
signature doesn't match the one of the bound function. Make it function<void(void *)>
.shared_ptr
, directly.The bottom line: boost::function<void (void *)> op = boost::bind(test_method, user_test_case, _1);