
3 Mar
2009
3 Mar
'09
8:05 p.m.
Hello, 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.