On 03/06/2012 18:36, Eric Niebler wrote:

Plus I don't have a good way to distinguish between a terminal of
shared_ptr<T>  and a terminal of T which is held through a shared_ptr.

Have you tried a grammar? Something like (untested) proto::terminal<
boost::shared_ptr<  proto::_>  >  ?

That would match expressions of the form (assuming I have binary plus in my grammar)

shared_ptr<T> p1, p2.
p1 + p2;

This is exactly what I do not want. I don't want my grammar to be cluttered by implementation details. It makes no sense semantically for shared_ptr to be values, it's just a technique used for life time management of specific values.

If I ever introduced shared_ptrs as values in my grammar, they might do something entirely different.

To separate this more or less cleanly, I use a special tag for nullary expressions where shared_ptr is just an implementation detail, but it's still not really satisfying since the value doesn't have the right type in the tree.
_______________________________________________
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto

Reply via email to