2 May
2007
2 May
'07
11:18 a.m.
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