
----- Original Message -----
The approach with boost::optional cannot do this. In-place factories need a lambda object itself. So maybe you're not interested in this approach. (But, please note that we cannot know the type of lambda expression without actually constructing lambda objects.)
Since lambdas are copy-constructable, I'm unclear what problem the boost::optional suggestion was trying to solve. And yes, I have found that indeed you must say: auto x = lambda; decltype(x) rather than just decltype(lambda). I understand that once again captures probably forced this restriction as it interacts with the surrounding scope, but it seems unfortunate that stateless lambdas can't be declared in-place like that. Anyway, it seems like Phoenix and boost::lambda are still the best way to accomplish these kinds of tasks. I was hoping to make C++11 lambdas work as over time Phoenix and boost::lambda will just become more obscure as everybody gets used to the new syntax. Thanks- Augustus