Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-03-29 20:57:03


From: David Abrahams <abrahams_at_[hidden]>
> From: "Vladimir Prus" <ghost_at_[hidden]>
>
> > >> I know that. I meant to state that, in my opinion, this doesn't prevent
> > body
> > >> from having non-trivial dtor and *have it called*,
> >
> > >True.
> >
> > Then, scoped_ptr's docs contain an incorrect statement, and that is better
> > fixed.
>
> Agreed. Greg?

I think so, but I havan't been following this thread very closely.
Beman?

> > >> , and that one can assure that you never call delete on an object with
> > >> incomplete type.
> >
> > >How?
> >
> > As I have stated in previous post, with sizeof(T):
> >
> > ~scoped_ptr() {
> > sizeof(T);
> > delete p;
> > }
>
> Ah, wonderful. We should put this riff in boost/utility.hpp
>
> template <class T>
> void delete_(T const volatile* x)
> {
> sizeof(T);
> delete x;
> }
>
> Then "delete x" becomes boost::delete_(x)

Yes. Of course some compilers might complain about
the apparently useless line, so perhaps

    if (sizeof(T))
       delete x;

Regardless, a comment is in order.


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