(The revisions are identical or unavailable.)

This is an example of using boost.function, boost.bind with member functions. One situation this might be useful is when one wants to use a generic numerical algorithm such as Brent's method for root-finding inside a class.

double F1(boost::function<double(double)> f1); // e.g. Brent's method for root-finding

class A {

public: double TwoArg?(double x, double y); void Compute(double y);};

double A::Compute(double y) {

// 2nd argument of A::TwoArg? binds to y, 1st argument remains open boost::function<double(double)> f1 = boost::bind( boost::mem_fn(&A::TwoArg?), this, _1, y); return F1(f1);}

Disclaimer: This site not officially maintained by Boost Developers