
10 Apr
2008
10 Apr
'08
2:43 p.m.
On Thu, Apr 10, 2008 at 3:10 PM, Giovanni Piero Deretta <gpderetta@gmail.com> 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