Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2001-03-29 02:19:33


David Abrahams wrote:

>>I don't understand something in scoped_ptr docs. When discussing handle/body
>>idiom, it is said that
>>
>> This code requires that class body have a trivial destructor to avoid
>> undefined behavior.This is because the definition of class body is not
>> visible at the time scoped_ptr<> deletes it.

>The problem is what I'd consier a bug in the C++ standard: you are allowed
>to call detete on a pointer whose value_type is unknown at the point where
>delete is called. In that case, the destructor of the referent is never
>called :-(

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*, that in most cases (i.e.
when you don't take special measures to the opposite effect) it will be
called, and that one can assure that you never call delete on an object with
incomplete type.

-- 
Regards,
Vladimir

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