Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-20 09:22:54


"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
};

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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