Boost logo

Boost Users :

From: Darren Cook (darren_at_[hidden])
Date: 2004-02-23 03:44:33


> and I am trying to use lambda to find a song in c which matches a certain
> artist and title...
> ....
> If I try
> it = find_if(begin(),end(), boost::bind(&Song::artist,_1) == "a1" );
> it fails because "_1" is ambiguos (defined as lambda/placeholder and
> boost/arg )
>
> using boost::lambda::bind (and not including the "normal" bind ) gives a
> bunch cryptic errors...

That looks correct (but I'm no expert); could it be a problem with using
"a1" directly? Does something like this work:
   #include <boost/lambda/lambda.hpp>
   #include <boost/lambda/bind.hpp>
   using namespace boost::lambda;

   String a1("a1");
   it = find_if(begin(),end(), bind(&Song::artist,_1) == a1 );

> I'd also like to know what's the difference between boost::bind and
> boost::lambda::bind ?

My understanding was the boost::lambda is a superset of bind functionality,
so if the lambda library works on your compiler then you should use that.

Darren


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net