
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...