Boost logo

Boost Users :

Subject: [Boost-users] [boost-users][bind] binding std::for_each
From: Igor R (boost.lists_at_[hidden])
Date: 2009-03-03 15:05:30


I'd like to bind std::for_each with some other functor created on the
fly, like this:

struct A
  void f(int, int);

vector<shared_ptr<A> > vec;

void f(function<void(void)>);

// I want to call f() with a functor that would call A::f for every
element in vec

f(bind(&for_each, vec.begin(), vec.end(), bind(&A::f, _1, 1))); //
doesn't compile

f(bind(&for_each, vec.begin(), vec.end(), protect(bind(&A::f, _1,
1)))); // also doesn't compile

Thank you.

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