Boost logo

Boost :

Subject: Re: [boost] phoenix::bind
From: Joel de Guzman (joel_at_[hidden])
Date: 2008-10-02 19:01:54


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

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