|
Boost : |
From: Corwin Joy (cjoy_at_[hidden])
Date: 2001-07-19 18:09:53
> ----- Original Message -----
> From: Kevlin Henney <kevlin_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Thursday, July 19, 2001 4:20 AM
> Subject: [boost] Reference counting 'any'
>
>
> > > From: "Fernando Cacciola" <fcacciola_at_[hidden]>
<snip>
> > Kevin wrote:
> > The original, pre-Boost version of any was written so that it could be
> > implemented using reference counting and copy-on-write. This is why the
> > original version had no non-const access to the contained member -- this
> > was added as a result of Boost reviewing.
> >
> > I presume you are proposing a class that is intended to be transparently
> > reference counting, ie using copy on write?
> No, not copy-on-write.
> I propose a variant type that is not a (deep) lvalue, so no copy on write
is
> necessary. That's why I compared it to a *read only* string.
> You can *replace* the value but not *modifiy* it.
>
> >If so, the implementation
> > you provided needs to perform a copy on the non-const any_cast. If not,
> > then I would suggest it should be to avoid mixing unrelated semantics
> > and ideas ;-)
>
> Of course this changes the semantic in that you don't have non-const
access
> (which I forgot to modify on the sample code).
> If your concern is that users may get confused about the different
semantics
> then I would consider the submission of a different class.
>
Given that the original 'any' class provided const only access, I think it
would be interesting to hear what the compelling argument was for adding
non-const access to the 'any' class in the first place.
Corwin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk