
3 Dec
2008
3 Dec
'08
11:03 a.m.
On Wed, Dec 03, 2008 at 12:50:44PM +0200, Roman Shmelev wrote:
2) The object must be deleted not after the last shared_pointer to it will be destroyed, because some external functions will call it later one more time. And then it must be destroyed. 3) Of course, that external functions cannot accept shared_ptrs.
If you control the external function and suitable storage on that side, consider using an intrusive_ptr. One important benefit of those is that you can construct an intrusive_ptr<T> from a T *. -- Lars Viklund | zao@acc.umu.se | 070-310 47 07