|
Boost Users : |
From: Sam Partington (sam.partington_at_[hidden])
Date: 2002-08-12 04:10:16
> std::vector<Landmark>::const_iterator iter =
> std::find_if(v.begin(), v.end(),
> boost::bind<bool>(std::equal_to<std::string>(),
> boost::bind(&Landmark::getName, _1),
> name_to_find));
I've not started using boost::bind yet, but I've been meaning to for some
time, and I have read up on it, but one thing confuses me.
Am I right in thinking that boost::bind will automatically detect whether
the function call should be a->f(), a.f() or f(a)?
If so, how does it handle the (admittedly very pathological) situation like
this:
struct B;
struct A
{
bool f();
B* operator->();
};
struct B
{
bool f();
};
bool f(const A& a);
std::vector<A> v;
std::vector<A>::const_iterator iter =
std::find_if(v.begin(), v.end(), boost::bind(&A::f, _1));
Presumably it does the right thing and calls A::f, but how does it do that?
Cheers
sam
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net