Boost logo

Boost :

From: Hansi (hansipet_at_[hidden])
Date: 2008-06-10 09:46:38


When should be used boost/lamda/bind.hpp? Is there somewhere a
documentation which compares the 2 implementations?

Best regards
Hansjörg

Steven Watanabe schrieb:
> AMDG
>
> Robert Jones wrote:
>> First - is "boost/lambda/bind.hpp" equivalent to "boost/bind.hpp"?
>> Should it
>> ever be necessary to include both?
>>
>
> Bind and Lambda are separate. If you are using Lambda you need to use
> boost/lambda/bind.hpp which contains boost::lambda::bind.
>
>> Second - Is it true that a lambda function is syntactically and
>> semantically the
>> same as a bind finction, eg
>>
>> Given:- int foo( int i ) { return i + 3; }
>>
>> Are these two expressions the same?
>> bind( &foo, _1 );
>> _1 + 3;
>>
>
> They should behave the same, unless this is
> a boost::bind and you want to do further composition.
>
>> Finally (for now!) - why is this wrong?
>>
>> struct A { string identity( string ) const; } a;
>>
>> vector<string> v;
>> for_each( v.begin(), v.end(), cout << bind( &A::identity, a, _1 ) <<
>> '\n' );
>>
>> which is intended to output the return value of A::identity() for each
>> element of v,
>> separated by newlines.
>>
>
> It will only work if you using boost::lambda::bind, not boost::bind.
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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