Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-04-18 10:59:49

----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, April 18, 2002 11:47 AM
Subject: Re: [boost] Re: Intrusive smart pointer

> From: "Carl Daniel" <cpdaniel_at_[hidden]>
> > "David B. Held" <dheld_at_[hidden]> wrote in message
> > news:a9limo$9jc$
> > > I have uploaded
> >,
> > > which is an implementation of an intrusive reference-counted
> > > smart pointer that was shamelessly copied from boost::shared_ptr.
> >
> > One thing I'd change, although this does come with a cost, is to make
> > objects self-deleting. [...]
> IMO, there is no "standard" intrusive pointer. The variations are (at
> least):
> * type of count: public variable, accessor functions, base class;
> * name of count/accessors (addref, AddRef, addRef, attach);
> * initial value of the reference count (zero or one.)
> * delete in the pointer or self-delete in release.
Still, boost could define at least one of these variations.

Off the top of my head:

Define a new class: shared_object, which fixes some of the possible

Modify shared_ptr<T> to automatically select between two
implementations, one based on shared_object and the other as it is now (with
a external count).

The effect would be that *only* classes derived from shared_object would
automatically make shared_ptr behave intrusively.

Fernando Cacciola
Sierra s.r.l.

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