
Thanks. One more question, why the function 'doStuff' has to be 'public' otherwise, it won't compile? In my example, aFunction is a member function of 'A', so I can put 'doStuff' as private, right? but that won't compile.
for_each( aVector.begin(), aVector.end(), bind( &A::doStuff, this, _1, param1, param2 ) );
Can someone please tell me why?
On 2/16/06, Peter Dimov
Meryl Silverburgh wrote:
Thanks how can I call a function with 2 more parameters, like this: How can I pass 'param1', 'param2' to the fuction doStuff?
void A::aFunction( float param1, float param2) {
vector<int> aVector; aVector.push_back(1); aVector.push_back(2); aVector.push_back(3); aVector.push_back(4);
// want to loop thru the list and call A::print(int i, float param1, float param2)?
for_each( aVector.begin(), aVector.end(), bind( &A::doStuff, this, _1, param1, param2 ) );
}
void A::doStuff(int i, float param1, float param2) {
}
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users