Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-11-11 19:06:55


On 11/11/2004 12:40 PM, Peter Dimov wrote:
[snip]
>
>> With that you can build the reference graph to detect the cycles.
>
>
> Except that you can't. :-)
>
> struct X
> {
> std::vector<Y> v_;
> };
>
> If Y has shared_ptr instances that refer back to X, this is untraceable,
> because the tracer doesn't know that it should follow the pointer inside
> the std::vector.

Couldn't each stl container which contains (or might contain) a
shared_ptr also be reflected (e.g. v_'s presence in X recorded
in gc_desc<X> )? In this case, the cycle-finder could iterate
through each Y in v_ to find any cycles.


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