
a) You want to use _1 instead of _2 b) _1/_2 are in namespace boost::lambda boost::function<float(float)> f = boost::lambda::bind(fx,boost::lambda::_1,2); It is actually possible to use _2 but then the functor takes to args and ignores the first: boost::function<float(float,float)> f = boost::lambda::bind(fx,boost::lambda::_2,2); std::cout << f(100,3) << std::endl; // returns 5 cheers Arnaldur "Chris Weed" <chrisweed@gmail.com> Sent by: boost-users-bounces@lists.boost.org 19.10.2006 05:04 Please respond to boost-users@lists.boost.org To boost-users@lists.boost.org cc Subject [Boost-users] [function][lambda] Create a boost function to a bind functor Hi, I would like to create a boost::function to a lambda::bind functor such as float fx(float a, float b) { return a+b; } int main() { boost::function<float(float)> f = boost::lambda::bind(fx,_2,2); std::cout << f(3) << std::endl; return 0; } I would expect this to bind 2 to the "b" argument of fx, and print "5". Instead with msvc-8.0 I get a bunch or compile errors. Any help would be greatly appreciated. Chris _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users