struct A
{
A(int v):value(v){}
int someFun(){return value;}
int someOtherFun(int v=0){return v+value;}
int value;
};
int main()
{
boost::shared_ptr<A> a(new A(42));
//boost::function<int()> b1(bind(&A::someOtherFun,a,_1)); //Error
boost::function<int()> b2(bind(&A::someFun,a));
b2();
return 0;
}
bind(&A::someOtherFun,a)();
fails with compile error: error: invalid use of non-static member function
How to bind someOtherFun similar to the someFun? i.e, they should bind to the same boost::function type.