Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with boost::bind, boost::shared_ptr and std::find_if algorithm
From: Nathan Crookston (nathan.crookston_at_[hidden])
Date: 2010-08-03 11:48:17

Hi Przemyslaw,

On Tue, Aug 3, 2010 at 7:34 AM, <przemyslaw.sliwa_at_[hidden]> wrote:
> All,

<snip code>

> Since this looks really ugly I would like to ask you how this can be
> converto to find_if algorithm with a little help of boost::bind. I tried but
> could not succees.

It seemed necessary to add a nested bind call.

#include "boost/bind.hpp"
#include "boost/shared_ptr.hpp"

#include <map>

struct WTH
  int cut;

int main()
  int cut;

  typedef std::multimap<int, boost::shared_ptr<WTH> > DataMap;

  std::find_if(myMap.begin(), myMap.end(),
                boost::bind(&DataMap::value_type::second, _1)) == cut);

  return 0;



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at