Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2003-12-12 09:25:03


On 12/12/2003 07:57 AM, Peter Dimov wrote:
> David B. Held wrote:
>
[snip]
>>super2* which is pointing to a child_mi object. If p were
>>omniscient (or even just psychic),
>
>
> ... or a shared_ptr, IIUC,
Yes, that was my point. One could argue that this is
a programming error, just as one could argue that deleting
a superclass pointer instead of a most derived class pointer
is a programming error; however, to do this the programmer
must KNOW that the last smart_ptr destructed is the one for
the most derived class (for the case of non-virtual DTOR
classes). Thus, the programmer must be "semi-omniscient",
but then the whole point of using smart_ptr's is that
the programmer does NOT KNOW which pointer will be the
last to be destructed. Of course maybe it wouldn't be
too hard for the programmer to know that the last one will
be for the most derived class, but I don't know.


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