Boost logo

Boost :

Subject: Re: [boost] intrusive_ptr design question
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-07-06 11:23:41


On Mon, Jul 6, 2009 at 10:07 AM, Frank Mori Hess<frank.hess_at_[hidden]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Monday 06 July 2009, Zachary Turner wrote:
>> You shouldn't have to store 2 function pointers for every
>> intrusive_ptr object.  You should only have to store 2 function
>> pointers per instance pointed to, and then 1 reference to some shared
>> structure in each intrusive_ptr object.  Much like shared_ptr
>> currently does.
>
> You'd still need a pointer in every intrusive_ptr object to point at the
> shared_structure, plus you'd have to do dynamic allocation of the shared
> object.  That is never going to fly.
>
> - From the "main reasons to use intrusive_ptr" section of its documentation:
>
> "The memory footprint of intrusive_ptr is the same as the corresponding raw
> pointer;"
>

Ok, so let me rephrase then: Is there a case to be made for a more
flexible shared_ptr (either through modification or through a new
class addition) that allows one to provide custom reference counting
semantics much the same way that shared_ptr allows one to provide
custom deletion semantics?


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