Boost logo

Boost :

From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-06-10 07:10:35


This is my first time posting to this list, so I hope you'll forgive me it my
etiquette is awry.

I'm new to the Boost libraries, and just learning my way around, guided mainly
by Bjorn Karlson's book - any other book recommendations would be most welcome
btw, and there a few things I just don't quite get!

First - is "boost/lambda/bind.hpp" equivalent to "boost/bind.hpp"? Should it
ever be necessary to include both?

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;

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.

Thanks in advance for any guidance!

Rob.

-- 
ACCU - Professionalism in programming - http://www.accu.org

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