Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-04-02 17:59:26


At 10:25 AM 3/29/2001, Vladimir Prus wrote:

>Then, scoped_ptr's docs contain an incorrect statement, and that is
better
>fixed.

I think it is unclear, but not incorrect. There is nothing wrong with
deleting a pointer to an incomplete type if the type has a trivial
destructor, AFAIK. I'll rewrite it tomorrow when I feel a bit sharper, and
post the rewrite here for comment.

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

If you did that, scoped_ptr could not be used with incomplete
types. Although you have to be careful that the destructor is trivial, it
is highly desirable to be able to use scoped_ptr with incomplete types. I
must be missing your point.

--Beman


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