$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] Simple Lambda Problem
From: Richard Howard (rhphotography.net_at_[hidden])
Date: 2011-04-07 04:02:58
I am currently trying to get to grips with using Lambda, but I have
hit a problem fairly early on.
Can anyone explain what I am doing wrong.
bool isCar(std::string const & val)
{
   return val.find("car") != std::string::npos;
}
int main()
{
   std::list<std::string> l;
   l.push_back("car");
   l.push_back("blue car");
   l.push_back("red van");
   l.push_back("bike");
   l.push_back("blue car");
   // ...
   l.remove_if(&isCar);
   // this works and is how I have done things in the past but I was
hoping to avoid the need for the separate function by using Lambda.
   // I have tried the following
l.remove_if(boost::lambda::var(boost::lambda::bind(&std::string::find,
boost::lambda::_1, "car")) != std::string::npos);
   // I am not sure why this does not work, can anyone point me in the
right direction?
}