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:[EMAIL PROTECTED]
> Sent: Tuesday, May 27, 2003 7:41 AM
> To: [EMAIL PROTECTED]
> 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
> 
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to