Boost logo

Boost :

Subject: [boost] [phoenix] default constructable stateless lambdas
From: Eric Niebler (eric_at_[hidden])
Date: 2012-09-24 15:01:55

While answering a question about Phoenix on stackoverflow[^1], I
discovered that Phoenix lambda types are default-constructable, so long
as all the terminals are also default constructable. That's handy when
the terminals are stateless. Can it (the default-constructability) be
relied on? It doesn't appear to be documented.

C++11 lambdas have the nice property that stateless ones are implicitly
convertible to raw function pointers. This can be implemented for
Phoenix if we can rely on the default-constructability of Phoenix lambda
types. In my stackoverflow answer I show how. It'd be pretty cool if
this were a standard part of all Phoenix lambdas. Is there interest?

Incidentally, I think it's really, really cool that Phoenix allows this
kind of extensibility. It's a very nice example of the benefits of the
introspection capabilities built into Phoenix. Perhaps this could be
worked into the docs somehow?


Eric Niebler
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at