Boost logo

Boost :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-12-01 10:02:34


-----Original Message-----
From: boost-bounces_at_[hidden] on behalf of Tobias Schwinger
Sent: Fri 12/1/2006 3:57 AM
To: boost_at_[hidden]
Subject: Re: [boost] FW: Suggestion for boost`s smart pointers
 
Sohail Somani wrote:
> Please see the following email about additional template parameters for
> scoped_ptr. The quick hack I wrote for it is below (I've used this in
> previous project as well). I think it would be very useful to many users
> and wouldn't change any source using scoped_ptr.

This question makes me feel nostalgic. My first request on this list looked very
similar (I needed to Release() COM objects). I just dug up the reply and it
seems there used to be this kind of parametrized deletion for shared_ptr.

----------------

Thanks for your reply but the domain of COM objects lends itself well to shared_ptr.

-----------------

Actually, I don't think that parametrized deletion belongs into the interface of
a smart pointer. It's up to other components to have proper deletion semantics.
Still, there sure are cases (dealing with third-party or plain C components)
where it is a practical thing to have.
------------------

I went through the archives after the posts and I have realized that scoped_ptr is not changing! I will still disagree that the deleter shouldn't be a parameterized type. The only other option is using a type erasure mechanism like shared_ptr which is more trouble than its worth for things like deallocating C resources.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk