Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2003-12-11 08:51:26


AlisdairM <alisdair.meredith_at_[hidden]> wrote:
> Conventional wisdom says a base class should either have a public
> virtual destructor, if intended for use polymorphically, or a
> protected non-
> virtual destructor if derivation is purely to inherit the
> implementation.
>
> With shared_ptr, we can use this second type of class polymorphically
> as well!

> Not sure this is actually useful though, as I'm sure the shared_ptr
> overhead is more than the cost of adding a virtual destructor ;¬ )

There is a way to achieve this goal with much smaller overhead in smart
pointer with strong ownerership semantics (yes, I mean auto_ptr). It's
currently open for discussion on comp.std.c++ .

B.


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