Boost logo

Boost :

Subject: Re: [boost] [smart ptr] Any interest in copy-on-write pointer for C++11?
From: Ralph Tandetzky (ralph.tandetzky_at_[hidden])
Date: 2013-02-13 15:53:44


On 02/13/2013 06:43 PM, Vicente J. Botet Escriba wrote:
> Le 13/02/13 16:46, Ralph Tandetzky a écrit :
>>
>> * pointer-semantics or value-semantics and nullptr (brought up by
>> Vicente)
>>
>> - Should the COW-class be nullable? If not, then it should probably
>> not be called cow_ptr.
>> - This question has not been discussed to the end yet. Personally, I
>> don't think that null-cow_ptrs are very useful.
>>
>> * Different member and non-member functions (brought up by Vicente)
>>
>> - relational operators (brought up by Vicente)
>>
>> - It is not clear, whether operator==() on cow_ptrs should only
>> compare pointers or also pointees. This would depend on whether
>> the COW-class is considered a pointer or a genuine value.
>>
> If you choose for your class to have value semantics the relational
> operator should compare pointees.
>
> Vicente
I totally agree. And in my opinion making the class have non-nullable
value semantics would be the best alternative. I would then call it
clone_on_write<T>. Any comments, opinions or suggestions, everybody?
That would also bury the idea of having a read_ptr<T> and a
write_ptr<T>, where I find the interface unnecessarily complicated
without much gain (IMHO).

Ralph


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