Subject: Re: [boost] [xint] Boost.XInt formal review
From: Peter Dimov (pdimov_at_[hidden])
Date: 2011-03-07 11:37:42


Jeffrey Lee Hellrung, Jr. wrote:

> Another concern with COW in general is iterator invalidation.

This is the only concern. The moment you allow non-const iterators into your
potentially shared representation, you have to think very carefully about
specifying when these are invalidated (the correct answer is "on any
operation"). std::string has this problem; since CoW is deemed an
implementation detail there, obtaining a non-const iterator or reference
into a string disables sharing for this string forever (because you can't
track the lifetime of the iterator or reference).