
5 Mar
2010
5 Mar
'10
6:33 a.m.
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; }