6 May
2003
6 May
'03
7:18 a.m.
--- In Boost-Users@yahoogroups.com, "Lehrer, Joshua"
WRT boost::shared_ptr<>, why not template the explicit constructor that takes a T*? This way, it could select the correct destructor at construction time:
struct base { ~base(); }; struct sub : public base { ~sub() }; boost::shared_ptr<base>(new sub);
The above code currently only calls ~base(); Templating the explicit single argument constructor would allow the above code to call ~sub().
Why not just have a virtual destructor? Then delete will be able to destroy your derived class properly: struct base { virtual ~base(); }; Dan