Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-06-01 05:58:48


Alexander Terekhov wrote:
> Maksym Motornyy wrote:
>>
>> Thanks for articles. Well, I understand that multithreaded
>> environment can be a bad place for COW optimization.
>
> That's a myth.

It depends on the interface of the class. Returning pointers and references
into the object is bad, as is const/non-const overloading where the
non-const version can be used for read access.

Non-const member functions of the begin()/end() variety are worse than just
returning a single reference into the object, because you can't "copy on
write" between the two, or they'll get out of sync.

Reference-counting immutable objects is fine, but COW can be a pain.


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