
On Wed, Sep 16, 2009 at 12:54 PM, Stefan Strasser <strasser@uni-bremen.de> wrote:
Am Wednesday 16 September 2009 10:34:35 schrieb Berserker:
Dmitry Goncharov wrote: > The difficulty that your example demonstrates is caused by the nature > of template template parameters. scoped_ptr should not be blamed for
that.
I agree, moreover I think that the advantages of this patch (often required in the list)
could you explain what those advantages are? a scoped_ptr can't be copied at can't be moved. so there are two use cases left for a scoped_ptr deleter:
- scoped_ptr as a class member: execute code when the class gets destructed -> that's what a destructor is for.
You could say the same for use delete in the destructor and never use scoped_ptr at all.
- scoped_ptr as a local variable, execute code when something goes out of scope -> that's what boost ScopeExit is for.
The same is valid for delete as well.
what is the use case that only a scoped_ptr deleter can handle?
None. The same is valid for almost anything else in RAII. But RAII simplifies things *a lot*. -- Felipe Magno de Almeida