Boost logo

Boost :

Subject: Re: [boost] phoenix::bind
From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-10-02 10:15:37


Joel de Guzman:

> Oh my, there's a lot of discussion I can't find that snippet
> of information. Anyway, it has something to do about using
> the "let" semantics be applied to "lambda" only on the
> top level. I think it will work with the lambda syntax and
> behavior you sought for.

Not quite.

The purpose of unlambda is to allow you to pass a lambda expression into a
function that expects an ordinary function object and might use it as a part
of another lambda expression.

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.


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