
2 Oct
2008
2 Oct
'08
11:01 p.m.
Peter Dimov wrote:
Joel de Guzman:
std::cout << "Double Square of " << 5 << " is " << ffx(lambda[sqr(_1)], 5.0)() << std::endl;
This is not quite what I was after. As I understood your original problem, we are looking for a construct lflx such that:
lflx( f )
yields a function ffx such that
ffx( x )
yields f( f( x ) ).
In other words, we want
lflx( sqr )( 5.0 ) to give us sqr(sqr(5.0)).
Sure. Like this: ffx(lambda[sqr(_1)], _1)(i5) // pardon no rvalue (yet) ? Cheers, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net