Boost logo

Boost Users :

Subject: Re: [Boost-users] how to work with shared pointers to avoid clumsiness
From: Lars Viklund (zao_at_[hidden])
Date: 2008-12-03 06:03:13


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_at_[hidden] | 070-310 47 07

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