Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2001-03-28 02:59:43


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.

However, I think that "time scoped_ptr<> deletes it" is when dtor for
scoped_ptr is called, from which I decide that class body may have any dtor
if it is defined before *instantination point* of ~scoped_ptr<>. Futher, one
can make sure that class that scoped_ptr deletes is complete at deletion
point by adding dummy "sizeof(T);" statement to dtor. Can anybody clarify
the matter?

-- 
Regards,
Vladimir

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