
On Sun, May 1, 2011 at 10:44 AM, Phil Bouchard <philippe@fornux.com> wrote:
Hi,
I made the requested corrections to the Block Pointer, I've added automated tests and its corresponding Jamfile. The tests can be found here: https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/test/block_... https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/test/block_...
Once again the documentation can be found here: https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/doc/tutoria...
Now I'm pretty sure I haven't forgotten anything and I am requesting a review.
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? Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode