Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-06-07 14:51:31


"Eric Niebler" <eric_at_[hidden]> writes:

> I have a new idea. Deep copy can be triggered by assigning to a dummy
> member:
>
> rule<> a, b;
> a.rule = parser >> that >> refers >> to >> b;
> b.rule = parser >> that >> refers >> to >> a;
>
> This allows:
> a = b; // shallow copy, creates alias
> a.rule = b.rule; // deep copy, modifies 'a' and all its aliases
>
> xpressive now works this way. It's heavier syntactically, but far less
> confusing then using a special deep-assign operator.

I think

  a->rule = b->rule

would be much more consistent with the other semantics of this thing.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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