Boost logo

Boost Users :

From: Meryl Silverburgh (silverburgh.meryl_at_[hidden])
Date: 2006-02-16 14:46:45


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 <pdimov_at_[hidden]> wrote:
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net