Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-21 12:48:54


From: "David Abrahams" <dave_at_[hidden]>
>
> From: "Peter Dimov" <pdimov_at_[hidden]>
>
> > My reasoning was that has_virtual_destructor (whenever it appears in
> > type_traits) would be approximated with is_polymorphic (which is yet to
> > appear in type_traits too) anyway.
>
> I'm not sure we want a trait that gives false positives on all
> implementations.

Do we not want std::has_virtual_destructor at all? Or do we not want
boost::has_virtual_destructor at all? Or do we not want the particular
implementation that assumes that polymorphic types have virtual destructors?
Why are false positives a problem when the alternative (as in our case) is
to not check at all, or to check for is_polymorphic?

> > That aside, making our implementation detect the case implies a new
> > dependency on config.hpp (member templates) and on
> > type_traits/has_virtual_destructor.hpp. Is scoped_ptr<Base>(new Derived)
> a
> > common mistake? I think not, but I might be wrong.
>
> If it's worth storing an extra pointer for every shared object in the
> shared_ptr case, surely it's worth detecting this one at compile time?

There are so many things wrong with this sentence. :-) shared_ptr<Base>(new
Derived) is a feature. Comparing a feature with a required diagnostic isn't
fair. The extra pointer supports much more than this particular construct.

Not that I'm against detecting errors at compile time or something, but I've
always considered dependencies a problem.


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