|
Boost : |
Subject: Re: [boost] [xint] Boost.XInt formal review
From: DE (satan66613_at_[hidden])
Date: 2011-03-07 05:31:54
on 07.03.2011 at 9:17
Jeffrey Lee Hellrung, Jr. wrote :
> Another concern with COW in general is iterator invalidation. Either
> your iterator gets "fatter" and slower (e.g., by being implemented as a
> pointer to the object + offset), or you expand the class of operations
> that invalidate iterators beyond just resizing operations to *any*
> modification operation (compared to a class which does not use COW).
been the cow atomically ref counted you will NEVER notice it's there
cow is entirely internal detail which is not shown through the
interface (not counting the ensure_detached feature)
and iterator interface too
think of it: if an operation requires reallocation of the storage then
anyway iterators are invalidated
OTOH if an operation does not need a reallocation a cow object is left
referring to the same data and iterators are still left valid
moreover cow allows a plain user treat the objects of such a class as
plain values and don't bother if making some unmodified copies is
somewhat expensive (which is actually relatively cheap with cow)
this is VERY convenient and allows to concentrate on the e.g.
algorithm and not on that subtle details of whether to make a
reference to an object or just copy it
-- Pavel P.S. if you notice a grammar mistake or weird phrasing in my message please point it out
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk