
1 Jun
2005
1 Jun
'05
10:58 a.m.
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.