$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2005-11-26 14:00:16
With an ordinary C++ pointer, if I have a BaseClass and a DerivedClass derived
from BaseClass, then I can do
BaseClass* objectPtr;
objectPtr = new DerivedClass();
Later, if BaseClass has a virtual destructor, I can call delete(objectPtr) and the
DerivedClass destructor will be called.
Now, does this work with shared_ptr?
shared_ptr<BaseClass> objectPtr;
objectPtr = shared_ptr<DerivedClass>(new DerivedClass());
and later, delete(objectPtr).
Does any of the magic going on behind the scenes prevent shared_ptrs from
being used like this?
Merrill