Boost logo

Boost Users :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-08-09 17:32:00


On Friday 09 August 2002 06:08 pm, Tom Matelich wrote:
> I have a vector of
>
> class Landmark
> {
> public:
> std::string const& getName() const;
> ...
> };
>
> I want to do a find_if for a name that I have.
>
> something like
> std::find_if(begin, end, boost::bind(std::equal<std::string>(???,
> name_to_find)));
>
> What do I put for the ??? ?

I presume that [begin, end) is an iterator sequence of Landmark instances?
Then ??? = boost::bind(&Landmark::getName, _1), meaning that the first
parameter to std::equal<std::string>::operator() is a call to
Landmark::getName where the object parameter (this) is the first argument
(_1) to the bind function object.

        Doug


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