
Hi all, I am storing a set of functors to be invoked in a vector, like this: std::vector< boost::function<void> > functors; At a later time, I would like to invoke each of the functors in the vector. I am trying to do this using Boost.Lambda, to start learning about the Lambda library, but I can't figure out what to write. if I write: std::for_each(functors.begin(), functors.end(), _1); None of the functions are invoked. if I try: for_each(funtors.begin(), functors.end(), _1()); I get compile errors. I suspect this is because the lamda expression is being executed immediately instead of getting passed in to for_each. Everything works fine when I use a separate Invoker function in the usual fashion, like this: void Invoker( boost::function<void> functor) { functor(); } std::for_each(funtors.begin(), functors.end(), Invoker); How can I get the lambda library to invoke each function in the vector? More generally, if the functions were function<void, T>, how could I bind the T parameter in the lambda expression? Thanks for any help, Tom Wenisch Computer Architecture Lab Carnegie Mellon University