Boost logo

Boost :

Subject: Re: [boost] Phoenix.bind VS Lambda.bind
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-04-09 13:20:11


Alexey Tkachenko wrote:
> Hi,
> Now I'm looking at Phoenix and Lambda libraries. Could somebody
> explain why Lambda allows to use the following expression:
> void foo(int) { ... }
> ...
> bind(foo, _1)(10);
>
> yet Phoenix does not.
> Phoenix requires to use helper variable:
> void foo(int) { ... }
> ...
> int i = 0;
> bind(foo, _1)(i);
>
> I've read document about "Forwarding Function Problem"
> (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm). I
> understand the core issue, but how does Lambda.bind solve it?

Lambda takes by value, Phoenix takes by reference.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk