On Mar 27, 2015, at 1:16 PM, Gottlob Frege
On Wed, Mar 25, 2015 at 8:55 AM, Jakob Riedle
wrote: A null-deleter would make it basically non-owning..
That doesn't solve Efficiency, but it allows for non-owning shared_ptr's. Thank you!
It doesn't, however, solve the underlying safety issues. Smart Pointers tend to be smart in two ways:
- track ownership to correctly delete object - be safe
With flex_ptr (or shared_ptr with custom deleter), how do you know that a non-null flex_ptr is pointing to valid memory or not. Or if it is valid on this line, but not the next, due to threading or something.
Consider using boost::intrusive_ptr. You can remove the object from intrusive_ptr's management by calling intrusive_ptr_add_ref() on it manually, and return it by calling intrusive_ptr_release(). Josh