Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2003-02-20 09:34:49


"David Abrahams" <dave_at_[hidden]> wrote in message
news:u8ywbdoap.fsf_at_boost-consulting.com...
> "Fernando Cacciola \(Home\)" <fernando_cacciola_at_[hidden]> writes:
>
> > Hi!
> >
> > I'm under the process of getting rid of some of my old
> > smart pointers replacing them by shared_ptr<>.
> > There is however one idiomatic usage that it's pretty
> > hard to locate and edit, so I wondered if shared_ptr<>
> > could support it.
> > One is initialization from a null pointer value, as in:
> >
> ...
> >
> > this one is very useful because its very idiomatic.
> >
> > The other one, definitely not recommended but which *I* need
> > to support because my code if full of it,
> > is assignment of a null pointer value as a synonym for reset(),
> > as in:
>
> ...
>
> > What do you think?
>
> I think this looks like a job for
>
> template <class T>
> struct my_shared_ptr : shared_ptr<T>
> {
> ... // additional interface here
> };
>
Yes, this is what I did actually...
I just thought that the addition, -> the initialization from 0, was good
enough to be considered as a formal extension.

--
Fernando Cacciola

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk