|
Boost : |
From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-07-14 21:21:55
> The count of 1 could be introduced as a static and would be the initial
> value for any given pointer. The only operations that could lead to failure
> would be copying operations (ie cp ctor and op=), but in such cases failure
> would not result in the loss of the held object, only the failure to share
> it:
Please explain the advantage of these semantics. Of course we could make the
change, but what's the point?
Here, as an example, I've outlined the utility of the current design. I
don't think we should consider an alternative unless someone can make a
cogent argument about its utility.
I consider it valuable to be able to copy and assign without throwing
exceptions. It is very convenient when implementing handle/body classes.
Once the entire handle/body package is created, it can be copied as often as
desired with no concern for exceptions being thrown. Regardless of which
technique is used, the construction and allocation of the body part can
always throw an exception, so it is better to localize all of the exception
throwing in one place rather than spread it across the operations. It can be
important to know that certain operations don't throw so you can use them in
recovery actions.
-Dave
------------------------------------------------------------------------
eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk