
On Wed, 28 Jul 2004 16:19:21 +0200, Mattias Brändström wrote:
To me it seems that this is something that I should be able to do with the BLL. If someone could point me in the right direction here I would be really greatful!
Hi, You're almost there. The problem is that you're using boost::bind instead of boost::lambda::bind. I think that boost::bind is more portable, but it doesn't support lambda expressions. Here's a working version of your code: #include <algorithm> #include <vector> #include <boost/lambda/lambda.hpp> // needed for lambda operators #include <boost/lambda/bind.hpp> // not boost/bind.hpp class Foo { public: int bar() { return 42; } }; int main() { std::vector<Foo> v; v.push_back(Foo()); using namespace boost::lambda; std::count_if(v.begin(), v.end(), bind(&Foo::bar, _1) == 42); return 0; } Daniel