
11 Feb
2013
11 Feb
'13
9:52 p.m.
Jeffrey Lee Hellrung, Jr. wrote: On Mon, Feb 11, 2013 at 12:01 PM, Ralph Tandetzky < ralph.tandetzky@googlemail.com> wrote:
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, i.e., 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.