Boost logo

Boost :

Subject: Re: [boost] phoenix::bind
From: Joel de Guzman (joel_at_[hidden])
Date: 2008-10-02 11:41:22


Peter Dimov wrote:
> Joel de Guzman:
> ...
>>> template<class F> void g( F f )
>>> {
>>> h( bind( f, _2, _1 ) );
>>> }
>>>
>>> int main()
>>> {
>>> g( _1 < _2 ); // fail
>>> g( unlambda( _1 < _2 ) ); // works
>>> }
>>>
>>> A top-level lambda[] that does let()[] will not work for this case.
>>
>> Yep, I'm keeping the behavior of protect, not unlambda.
>
> What is the current Phoenix way to make the above work?

I don't think there's one, yet. Never had the need for it
(at least not yet). unlambda is a low hanging fruit in any
case.

>> As I mentioned in my other post. val(_1 < _2) can probably be the
>> unlambda behavior.
>
> This doesn't feel right to me. val(x)(...) returns x. val(_1 < _2)( 1, 2
> ) ought to return _1 < _2. unlambda( _1 < _2 )( 1, 2 ) returns true.

Why do you need to write val(_1 < _2) and not just _1 < _2 ?

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