Boost logo

Boost :

From: Schoenborn, Oliver (Oliver.Schoenborn_at_[hidden])
Date: 2003-05-28 00:17:25


Circular refs are easy to avoid with smart_ptr lib but idiomatically what
you are really looking for is DynObj (and maybe RRef ) in the NoPtr lib
(http://noptrlib.sourceforge.net). Strict ownership is ideal for pimpl and
in particular your example of circular dependency, as supported by the NoPtr
lib.
Oliver

> -----Original Message-----
> From: Chuck Messenger [mailto:chuckm_at_[hidden]]
> Sent: Tuesday, May 27, 2003 7:41 AM
> To: boost_at_[hidden]
> Subject: [boost] smart_ptr suggestion: Support decrementing
> shared_ptr'scount, forself-references
>
>
> Suppose you have this:
>
> struct X {
> shared_ptr<Y> y;
> ...
> };
>
> struct Y {
> X x;
> ....
> };
>
> struct Z {
> Z() : pimpl_(new Y()) { pimpl_->x.y = pimpl_; }
> shared_ptr<Y> pimpl_;
> ...
> };
>
> I'm using the "pimpl" idiom. When I create Z, I create an embedded Y
> ("y"), setting y's x so that it points to y.

> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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