Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 1999-07-13 07:08:28

At 08:01 AM 7/13/99 +0100, Kevlin Henney wrote:

>I was discussing this recently w/ someone, and the idea that failed
>automatically leads to deallocation of the given object may not
always be
>desirable (on failure the user may have other plans for the object).
>failure may be more desirable and, for detached counts, may be
achieved in
>one of two ways:
> 1. Use of a null count to indicate 0. I tend not to like this
option as
> it leads to too much conditional code for a common case. It also
uses up
> the null bandwidth, which I tend to reserve for "not counted", ie
> passing a non-counted object into a function that accepts only a
> ptr; w/ a null counter the smart pointer acts as an adaptor for
its own
> type. Should we consider this for shared_ptr? Eg
> T t;
> shared_ptr<T> p(&t, nocount);
> 2. Using a shared static count of 1, which primarily has the
effect of
> reducing the cost of allocation where objects do not end up being
> shared.

Two thoughts:

Auto_ptr got into so much trouble by adding an apparently simple
feature to a very simple class. This experience makes me very wary
of trying to add features to smart pointers.

There are an apparently endless number of smart pointers. John Max
Skaller has identified something like 36, each with its own feature
set, and I don't think he even touched on some of your ideas. If
there are too many flavors in a library, people become confused and
don't use any of them.


------------------------------------------------------------------------ home: - Simplifying group communications

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