Subject: Re: [boost] [smart ptr] Any interest in copy-on-write pointerforC++11?
From: Peter Dimov (lists_at_[hidden])
Date: 2013-02-11 16:52:25
Jeffrey Lee Hellrung, Jr. wrote:
On Mon, Feb 11, 2013 at 12:01 PM, Ralph Tandetzky <
> > Nice idea though. write_ptr<T> would behave like value_ptr<T>
> Not as I understand it; write_ptr would behave similar to unique_ptr,
> it would be move-only.
You could, in principle, make it do a deep copy, but the point of the
exercise is to avoid inadvertent expensive copies, so a move-only pointer
makes a bit more sense, I think. An explicit copy() could perform the deep
copy, if needed. On the other hand, making it do a deep copy is slightly
more flexible because you could then use it as a value_ptr if you don't care
for the whole CoW business. I could go either way on that.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk