27 May
2004
27 May
'04
6:23 a.m.
On 26 May 2004, at 11:48 PM, Vesselin Kostadinov wrote:
//using the right combination of for_each, bind, ref, mem_fn, etc: // std::for_each(foos.begin(), foos.end(), // boost::bind(???????), // _1, boost::ref(param)); }
Hmm, I don't know if you could do that directly. If you added a function to foo like such: void call_func_ptr(int &x) { this->func_ptr(x); } then you could do: std::for_each(foos.begin(), foos.end(), boost::bind(&foo::call_func_ptr, _1, boost::ref(param)); You definitely want the _1 as a parameter to boost::bind, not std::for_each. Every argument (including the "this" pointer) should be mentioned in the bind, even if only to provide the placeholder. Scott