Boost logo

Proto :

Subject: Re: [proto] Holding children by copy or reference
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2013-09-30 14:08:18

On 30/09/13 08:01, Eric Niebler wrote:

>> Therefore, to avoid performance issues, I'm considering moving to always
>> using references (with the default domain behaviour), and relying on
>> BOOST_FORCEINLINE to make it work as expected.
> Why is FORCEINLINE needed?

The scenario is

terminal a, b, c, r;

auto tmp = a*b*c;
r = tmp + tmp;

Assuming everything is held by reference, when used in r, tmp will refer
to a dangling reference (the a*b node).

If everything is inlined, the problem may be avoided because it doesn't
require things to be present on the stack.

Of course, it's quite hacky.

Proto list run by eric at