Subject: Re: [boost] [Block Pointer] Review Request
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-05-01 21:01:10
On Sun, May 1, 2011 at 10:44 AM, Phil Bouchard <philippe_at_[hidden]> wrote:
> I made the requested corrections to the Block Pointer, I've added automated
> tests and its corresponding Jamfile. The tests can be found here:
> Once again the documentation can be found here:
> Now I'm pretty sure I haven't forgotten anything and I am requesting a
If I understand correctly, the point of block_ptr is that it allows
for cyclic references, since if shared_ptr is used instead, the
objects that are part of a cycle will keep each other afloat.
In my mind, the point of using a smart pointer is that the pointer is
dereferenced, the pointee is guaranteed to be afloat. So, the
limitations of shared_ptr in terms of not supporting cyclic references
aren't arbitrary; they stem from this same guarantee. If object A
points object B, and object B points object A, destroying either of
them will leave a dangling pointer in the other. This is true
regardless of whether we're using raw pointers or smart pointers.
The way to deal with this situation using shared_ptr is to use
weak_ptr to break the cycles. I suppose block_ptr solves this problem
more elegantly, but how?
Reverge Studios, Inc.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk