Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-04 10:50:23


----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, April 04, 2001 10:03 AM
Subject: Re: [boost] Re: scoped_ptr: trivial dtor?

> From: "David Abrahams" <abrahams_at_[hidden]>
>
> > From: "Beman Dawes" <bdawes_at_[hidden]>
>
> > > The downside is that it will break some existing code, although the
fix
> is
> > > trivial. But it does increase safety, so is worth doing. Where does
> that
> > > leave std::auto_ptr<>? Odd man out, as usual, I guess.
> >
> > Just missing a simple trick that nobody thought to apply. Maybe we could
> > propose this as an upgrade in the next version of C++.
>
> Tricks don't go in the standard. :-) You need "instantiating
> auto_ptr<T>::~auto_ptr, where T is an incomplete type other than void, is
> ill-formed, no diagnostic required." Can this pass as a DR? No, don't look
> at me.

I don't think that change is much different from the status quo, because
currently deleting a pointer whose referent has a non-trivial destructor is
undefined behavior, no diagnostic required. I guess your change would allow,
but not require the trick. However, it would also break hypothetical user
code, which would probably disqualify it as a DR.

-Dave


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