
on 07.03.2011 at 14:02 Ivan Le Lann wrote :
Without COW, the iterators used in another thread are not invalidated, since no data is shared.
Anyway, this whole thing sums up to: let me choose the container that suits my needs.
either of us don't understand what we are talking about suppose we have two cow implemented objects in different threads sharing exactly the same data lets assume that the ref counting is not atomic and to be fair that only one thread modifies its object then thread#1 thread#2 object a; object b; //object share the same data //"slim" iterators point to exactly the same data iterator i = a.begin(); interator i = b.begin(); //a is not modified and b.modify(); //modifying 'b' so its //the iterator is still //iterator in this thread is //valid in this thread //invalid now in thread#2 'b' gets new storage so the declared iterator invalidates but 'a' in thread#1 even after 'b' is modified still holds the same data so there is no reason for iterator to be invalidated i see no problems with iterators here what do i miss? -- Pavel P.S. if you notice a grammar mistake or weird phrasing in my message please point it out