Subject: Re: [boost] scoped_ptr deleter
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-09-15 11:38:34
> Stewart, Robert wrote:
>> That change creates multiple, distinct classes.
>> shared_ptr<T,boost::checked_deleter<T>> is not the same as shared_ptr<T,my_deleter<T>>.
>> By embedding the deleter in the shared_ptr with type erasure,
>> shared_ptr<T> is shared_ptr<T> is shared_ptr<T>, regardless of the deleter.
> Sure and that's the point :)
> As I wrote, since the "noncopyable nature" of scoped_ptr (shared_ptr is copiable by design), the creation of distinct classes isn't a problem. I think that the "real problem" here is to provide a solution that doesn't require extra memory overhead.
Noncopyable nature doesn't mean its type is insignificant. This change
would break the interface as the following code won't work anymore:
template< template< typename > class Ptr >
void make_a(Ptr< A >& p);
scoped_ptr< A > p;
This may not be the most frequent use pattern but nonetheless it's valid.
I'd opt for this change if it wouldn't affect the interface in the
breaking way. Otherwise, I like the way it is.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk