Boost logo

Boost :

From: Chuck Messenger (chuckm_at_[hidden])
Date: 2003-05-29 23:09:44


Schoenborn, Oliver wrote:

>>>>>- You always have A owns A_impl owns B owns B_impl refs A (what your
>>>>>original code seems to say), in this case B_impl contains an RRef<A>
>>>>>instead of a DynObj<A> and everything works
>>>
>>>I'd like to hear whether that's your case or not.
>>
>>No. A and B are completely symmetrical. They each equally
>>"own" the other.
>
>
> Not possible. This has nothing to do with NoPtr or boost::shared_ptr, it's
> even true for raw pointers. E.g.
> ...

Just look at my Node example -- you'll see that there is indeed complete
symmetry of ownership. There is a cyclic ownership graph -- hence the
trouble with traditional smart pointers.

>>However, I don't understand what NoPtr *does*.
>
>
> Simplistically,
> - DynObj destroys what it owns when it goes out of scope, is reset or
> acquires something new, and notifies any RRefs linked to it
> - RRef refers to a DynObj, but asserts that DynObj still exists when
> accessed
>
> Note that I said simplistically.

OK, thanks for the explanation -- I think I understand.

     - Chuck Messenger


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