Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2005-06-01 14:03:46

Peter Dimov wrote:
> Alexander Terekhov wrote:
> > Yeah, simply put, mutations of std::string object may invalidate
> > references and iterators (with COW inspired semantics for non-
> > const operator[]() et al. )... threads or no threads, COW or no
> > COW.
> Umm, not exactly.
> int x = s[0];
> (with non-const s) does not invalidate if COW isn't used,

Uhmm, that's not what the standard says.

Well, apart from

I suggest you simply read between the lines of "These rules are
formulated to allow, but not require, a reference counted
implemenation. A reference counted implementation must have the
same semantics as a non-reference counted implementation" note
having efficient COW implementation in your mind. (Among other
things I mean invalidation on refcount > 1 with refcount == 0
representing unshareable state.)



Boost list run by bdawes at, gregod at, cpdaniel at, john at