Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-01-07 12:45:09


From: "William E. Kempf" <wekempf_at_[hidden]>
> > No, the user would not be expected to do any bookkeeping. He would only
need
> > to call find_unreachable_objects() that would return a list of the
> > unreachable objects, and then, optionally, call break_cycles() with that
> > list as an argument. Or something like that. :-)
>
> And how would break_cycles() accomplish its task with out book keeping?

The information that is needed to break the cycles (a list of unreachable
shared_ptr instances) is generated by find_unreachable_objects for free,
since to determine object reachability, objects are scanned for shared_ptr
subobjects. When those shared_ptrs are reset() by break_cycles(), all
unreachable objects will be freed, their destructors will run, and any
weak_ptrs to those objects will correctly expire.


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