Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-06-16 07:48:06

On 06/16/2005 06:38 AM, Peter Dimov wrote:
> tr1::shared_ptr as well. It has been developed in response to Eric Niebler's
> scenario where the roots that form cycles are known to the programmer. (He
> ended up not using it, though :-) )
> It's possible to combine the two approaches and perhaps provide a default
> enable_tracking that does a memory scan as in sp_collector. I think that in
> most typical cyclic shared_ptr situations the problematic roots are known in
> advance, though, so a reset_and_collect-type solution may be enough.

But if the problematic roots are known in advance, why doesn't the
programmer simply use weak_ptr's to them? I guess it's because
the programmer doesn't know he's connecting to a problematic root,
although he knows what they are. I guess he doesn't want to store the
identity of the problematic roots in some global data structure and
check each time he makes a connection. Eric, is that about right?

Boost list run by bdawes at, gregod at, cpdaniel at, john at