Using for_each on a std::list<boost::function0<void> >

I have a std::list of boost::function0<void> I would like to call all items using a for_each statement. Is there a standard function object that I can pass into the for_each call that will call operator() on each element? Thanks Russell

Hi Russell, Russell Hind wrote:
I have a std::list of boost::function0<void> I would like to call all items using a for_each statement. Is there a standard function object that I can pass into the for_each call that will call operator() on each element?
Yes, std::mem_fun_ref. Complete example tested with g++ 3.2 is at the end.
HTH,
Volodya
#include

Thanks, I should have been able to think of that being that it was the first use of for_each I learnt!!! Cheers Russell Vladimir Prus wrote:
Hi Russell,
Russell Hind wrote:
I have a std::list of boost::function0<void> I would like to call all items using a for_each statement. Is there a standard function object that I can pass into the for_each call that will call operator() on each element?
Yes, std::mem_fun_ref. Complete example tested with g++ 3.2 is at the end.
participants (2)
-
Russell Hind
-
Vladimir Prus