Subject: Re: [boost] scoped_ptr deleter
From: Berserker (berserker_r_at_[hidden])
Date: 2009-09-16 10:22:17
Stefan Strasser wrote:
> the point of a deleter is to execute CUSTOM code at destruction.
> using scoped_ptr (without deleter) automates deletion so you don't have to
> write custom code that does that. that simplifies things a lot.
> but a scoped_ptr delete would provide the same thing as a destructor or a
> scope exit: execute custom code.
> the only reason shared_ptr or unique_ptr do have deleters is because the point
> of destruction aren't statically known, as they can be copied or moved.
My problem is simple: I have a custom memory manager (something similar
to this one
and when the scoped_ptr goes out of scope I need to invoke my custom
deleter instead of the classic "delete".