Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-04-10 10:43:16


On Thu, Apr 10, 2008 at 3:10 PM, Giovanni Piero Deretta
<gpderetta_at_[hidden]> wrote:
>
>
> Never tried it, but I'm quite sure that the phoenix lambda syntax also
> let you return lambdas:
>
> auto always = lambda[ lambda(_a = _1)[ _1 ] ];

this should be:

  auto always = lambda [ lambda(_a = _1)[ _a ] ]; // the inner lambda
is nullary, not unary

>
> auto always_10 = always(10);
>
> assert(alsways_10() == 10);
>
> should work (modulo modifying phoenix to work with rvalues).
> Disclaimer: I haven't tryed it! But even if it doesn't work with
> phoenix, it shouldn't be terribly hard to make this syntax work.
>

-- 
gpd

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