Boost logo

Boost Users :

From: Igor R (boost.lists_at_[hidden])
Date: 2008-07-17 09:24:52


> You need to make the call. The following does NOT seem to work, and I'm not sure why:
>
> for_each (functors.begin(), functors.end(), _1());

Well, that was the experssion I started with. But since it doesn't
compile, I thought probably _1 evaluates to (*functor)()...

> But the following does work:
>
> void call(function<void ()> f) { f(); }
> ...
> for_each (functors.begin(), functors.end(), call);

Yes, sure, but I'd like to create & call in-place lambda functor -
with no complicated bindings etc. - just a trivial one. And I still
don't belive it's impossible :-)


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