Boost logo

Boost :

Subject: Re: [boost] scoped_ptr deleter
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-09-16 12:22:27


Dmitry Goncharov wrote:
>
>
> Andrey Semashev wrote:
>> 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;
>> make_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.
>>
> The difficulty that your example demonstrates is caused by the nature of
> template template parameters. scoped_ptr should not be blamed for that.

I didn't blame it. And I don't consider my example difficult, anyway. It
provides a nice abstraction from the actual pointer type while not
introducing excessive genericity. I can't remember the exact code but I
surely used such technique somewhere in my code. Not sure it involved
scoped_ptr, though...


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