On Fri, Mar 5, 2010 at 1:33 PM, Archie14 <admin@tradeplatform.us> wrote:
Here is the sample that fails to compile. Complain is about foo being abstract
in IA. Any advise of how to make it work will be greatly appreciated.

#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/ptr_container/ptr_vector.hpp>

class IA
{
public:
       virtual int foo() const = 0;
};

class B : public IA
{
public:
       B (int a) : _a(a) {};
       int foo() const {return _a;}
private:
       int _a;
};


int _tmain(int argc, _TCHAR* argv[])
{
       boost::ptr_vector<IA> lst;
       lst.push_back(new B(1));
       lst.push_back(new B(2));

       boost::ptr_vector<IA>::iterator it =
               std::find_if (lst.begin(),
                               lst.end(),
                               boost::lambda::bind(&IA::foo,
boost::lambda::_1) == 1);
       return 0;
}


Replacing boost::lambda::_1 with &boost::lambda::_1 makes my compiler (gcc 4.1.1) stop
complaining. Is that what you need?

- Rob.