
2 Sep
2008
2 Sep
'08
8:52 p.m.
On Tue, Sep 2, 2008 at 14:53, Kurt Kohler <kohler@ao.com> wrote:
struct X { double f(double x) { return x; }
typedef boost::function<double (double)> ftype;
double call(ftype func, double x);
};
int main(int argc, char *argv[]) { X x; x.call(&X::f, 1.0); // Error occurs here }
&X::f requires 2 arguments (the this pointer and the function argument), so it's storable in a boost::function<double(X*const, double)>. Presumably you want this instead: x.call( bind(&X::f, x, _1), 1.0 ); HTH, ~ Scott