|
Boost : |
Subject: Re: [boost] scoped_allocator_ptr
From: Stefan Strasser (strasser_at_[hidden])
Date: 2009-09-11 11:07:53
Am Friday 11 September 2009 14:42:58 schrieb Felipe Magno de Almeida:
> On Fri, Sep 11, 2009 at 9:38 AM, Frank Mori Hess <frank.hess_at_[hidden]>
wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On Friday 11 September 2009, Felipe Magno de Almeida wrote:
> >> Hi,
> >>
> >> Is there an interest in a scoped_ptr that receives a Allocator
> >> parameter?
> >
> > I don't understand. I didn't think scoped_ptr did any allocations.
>
> It doesn't, but it calls delete. Which is not appropriate when using
> an Allocator.
> Though a make_scoped_ptr would be quite handy too for a scoped_ptr
> with Allocator
> support.
then you're looking for a deleter, as implemented by boost shared_ptr.
I'm not sure what the benefit would be of implementing a deleter for
scoped_ptr. deleters execute arbitrary code when the contained object is
deleted. for a scoped_ptr, that code already has a place to go: a destructor.
scoped_ptr just automates the common behaviour of a destructor, deleting an
exclusively owned pointer. if you need to do something else, you can do so in
a destructor.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk