Boost logo

Boost Users :

Subject: Re: [Boost-users] Using function operator in lambda expression
From: Niklas Angare (li51ckf02_at_[hidden])
Date: 2011-06-03 11:38:41


"Alexander Khomyak" wrote:
> According lambda documentation
> <http://www.boost.org/doc/libs/1_38_0/doc/html/lambda/le_in_details.html
> #lambda.operator_expressions> there is a possibility to use function
> call operator in lambda expression.
...
> (_1(1))(foo);

_1 is can be seen as a function object that returns its first argument.
_1(1) calls that function object with 1, the result of which is 1.

I think this is what you want:
bind(_1, 1)(&foo); // Equivalent to foo(1)

You have to include boost/lambda/bind.hpp to use bind.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net