
11 Jul
2008
11 Jul
'08
7:44 p.m.
Any thoughts on how to bind some arguments for a function? Consider the following: struct A { double operator()( const double a, const double b, const double c ) const { return a+b+c; } }; int main() { typedef function<double(double,double,double)> F3arg; typedef function<double(double,double) > F2arg; typedef function<double(double) > F1arg; typedef function<double() > F0arg; A a; const double x1=0.0, x2=1.0, x3=4.0; F3arg f3 = bind<double>( a, _1, _2, _3 ); cout << f3(x1,x2,x3) << endl; } How would I take "f3" and bind one argument? Something like: F2arg f2 = bind<double>( f3, _2, x2 ); // bind x2 to second argument of f3...