Boost logo

Boost :

Subject: Re: [boost] [smart_ptr] Interest in the missing smart pointer (that can target the stack)
From: Rob Stewart (rob.stewart_at_[hidden])
Date: 2016-02-08 19:24:45


On February 8, 2016 7:10:47 PM EST, Gavin Lambert <gavinl_at_[hidden]> wrote:
> On 5/02/2016 22:17, Rob Stewart wrote:
> > shared_ptr can be used to manage memory differently than you
> imagine,
> > it seems. I use shared_ptrs to share ownership between a plugin and
> > the application loading it while using custom deleters to ensure
> that
> > releasing the last reference means code in the dynamic library
> > releases the memory, if indeed any was allocated. The plugin
> > mechanism release such references before unloading a dynamic
> library,
> > so all's well.
>
> That's fine, and a perfectly reasonable use of a custom deleter.
>
> That's not what I was talking about, which was specifically limited to
> abuse of a null_deleter.

While I didn't mention it, I sometimes use a null deleter, in the same context, for static objects in the dynamic library.

___
Rob

(Sent from my portable computation engine)


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