Boost logo

Boost :

Subject: Re: [boost] Is there a way to specialize how a smart_ptr<T> releases the T?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-10-24 08:14:58

On 24/10/12 13:21, David Hagood wrote:
> On 10/23/2012 09:16 PM, TONGARI wrote:
>> Just provide it with your custom Deleter in the ctor.
>> template<class Y, class D> shared_ptr(Y * p, D d);
> OK, thanks.
> However - this does require every construction of a shared pointer to be
> passed that destructor - that seems error prone if it is known that all
> T must be released by a given call.

1) your library will be the one creating the shared_ptr, so this
wouldn't affect users
2) If the deleter is not passed to the constructor, it will be
default-constructed, which is enough for your needs.

Boost list run by bdawes at, gregod at, cpdaniel at, john at