Boost logo

Boost Users :

Subject: Re: [Boost-users] Does shared_ptr support interface pointers without a virtual destructor
From: Ben Pope (benpope81_at_[hidden])
Date: 2014-12-15 09:13:46


On Monday, December 15, 2014 04:31 AM, John Selbie wrote:
> What is the general guidance with using shared_ptr on interfaces that do
> not have virtual destructor?

http://www.boost.org/doc/libs/1_57_0/libs/smart_ptr/shared_ptr.htm#pointer_constructor

"[This constructor is a template in order to remember the actual pointer
type passed. The destructor will call delete with the same pointer,
complete with its original type, even when T does not have a virtual
destructor, or is void]"

You should also be good with make_shared, which is preferred.

Ben


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net