I have a class like this
class Foo {
public:
int GetID() const { return m_id; }
private:
int m_id;
};
I want to use find_if on a vector full of Foo objects, like this:
std::find_if(foos.begin(), foos.end(), ???.GetID() == 42);
I don't quite get what I have to write instead of ???. I know there is either _1 with boost::lambda or arg1 with boost::phoenix, but after that I'm at a loss.
Edit:
I tried the following which does not work, even though I saw it like this in many examples.
std::find_if(foos.begin(), foos.end(), boost::lambda::bind(&Foo::GetID, boost::lambda::_1) == 42);
Then I get the following error:
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'const boost::lambda::lambda_functor' (or there is no acceptable conversion)