Boost logo

Boost :

From: Kevin Atkinson (kevinatk_at_[hidden])
Date: 2000-03-23 22:55:35

On Thu, 23 Mar 2000, Greg Colvin wrote:

> From: Kevin Atkinson <kevinatk_at_[hidden]>
> > > They are neat. They supply several interesting and useful features.
> > > Deep/clone copy semantics complements other smart pointers which
> > > supply shallow copy or no copy semantics.
> > >
> > > The two header approach, with resulting relaxed requirement on T
> > > allowing use with incomplete types, looks like it may be more widely
> > > useful.
> >
> > Some points people seam to be missing.
> >
> > Making smart pointers more generic my taking in the necessary
> > copy/assign/delete functions as a parameters. This will avoid the need to
> > have a separate smart pointer for arrays and also allow them to be used
> > with libraries well a special function has to be called to free a pointer
> > as is command with most C libraries.
> This has been on my to-do list for years. The variety of possible
> copy/assign/delete operations, among other difficulties, has stymied
> me to date.

For most smart pointers all you have to do is pass in a class as a
parameter which has a single method, del. For my clone pointers the class
also has an assign and clone method. Take another look at my generic
code. I have uploaded my files to the vault at .

> > My ClonePtr which unlike the Copy pointer doesn't REALLY need the two
> > header approach because most of the time the Abstract Base Classes (ABC) is
> > visible. I find the clone pointers extrema useful as it makes using ABC
> > a lot safer as with the ClonePtr you can _almost_ treat them as if
> > there were the actual class (ie not a pointer) and thus many times avoid
> > the need for light weight wrapper classes for ABC which alloys one to treat an
> > ABC as an actual object.
> Classes with deep copy semantics seem to me more like "smart references"
> than smart pointers, so I wonder if they should have a pointer-like
> interface at all.

Could you elaborate.

Kevin Atkinson

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