$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Richard Damon (Richard_at_[hidden])
Date: 2007-05-02 07:18:34
One comment is that:
Class A {
}; // No virtual destructor
Class B : public A {
}
shared_ptr<A>(new B)
Should cause UB as the shared pointer will will eventually call delete on
its parameter, and since A has no virtual destructor and is NOT the type the
object was created with, you get UB.
It basically boils down to the equivalent to this
A* ptr = new B;
delete ptr;
which is a no-no.
A NEEDS to have a virtual destructor to use it the way you are.
Richard