Boost logo

Proto :

Subject: Re: [proto] Hold terminals by "smart" reference
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-06-04 20:51:48


On 04/06/2012 17:52, Eric Niebler wrote:

> I don't know what you mean by the "right type". If you want it held by
> shared_ptr to manage lifetime, then shared_ptr is the right type, it
> seems to me. Or use a wrapper around a shared_ptr, whichever.

I want all tree manipulation and transformation algorithms to see the
value as if it were a T and not a shared_ptr<T> or ref_holder<T>.

shared_ptr<T> is the right type to contain the terminal in the proto
nullary expression, but in that particular case it is not the logical
type of the value associated to that leaf node.

I want to be able to manipulate the tree using straight Proto tools
(otherwise I might as well not use Proto at all -- the point is to have
a well-defined de-facto standard framework for tree manipulation).

Those algorithms should not need to know how the value is stored in the
expressions. It is just noise as far as they're concerned.

Alternatively I'll need to provide substitutes for value,
result_of::value and _value, and ban those from my code and the
programming interface, telling developers to use mybettervalue instead
of proto's. That saddens me a bit.


Proto list run by eric at boostpro.com