Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-10-16 16:57:55


Peng Yu:

> I don't think my question was completely answered. Do you means
> reseting shared_ptr with an array from the stack is not defined? Or it
> is defined and shared_ptr can figure out it is from the stack and do
> not delete it?

It's undefined. shared_ptr cannot figure it out automatically. If you really
need to store the address of a stack object in a (short-lived) shared_ptr,
you need to tell it to not call 'delete' by using a null deleter.

http://boost.org/libs/smart_ptr/sp_techniques.html#static


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