Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-02-16 07:20:59


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 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