Boost logo

Boost :

Subject: Re: [boost] [phoenix] default constructable stateless lambdas
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-09-24 19:38:44


On 09/24/2012 09:01 PM, Eric Niebler wrote:
> 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.

That's one of the advantages of taking holding children by value.
It also means Phoenix expressions could be serializable.

> 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?

That probably requires that the function object be monomorphic too.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk