calling member functions on a boost::lambda pointer

Hi!

I am trying to use lambda to this use:

std::for_each( paBOBhErfolgAbgrenzung->begin(), paBOBhErfolgAbgrenzung->end(), _1->coutData());

where paBOBhErfolgAbgrenzung is an Array of pointers of a custom type. This example doesn't compile and as far as I can see I cannot call member functions of a functor... (right?)
Of course I could just define the << operator of my custom type and use cout, but I am interessted in the general behavior.
Is there a way to "batch"-call a member function of a custom type in a for_each?

Thanks!
Gabriel
boost::bind( &YourObjectType::coutData, _1 )

will do the trick.

EDIT: You'll need boost::lambda::_1, and probably boost::lambda::bind instead of boost::bind.
Last edited on
Topic archived. No new replies allowed.