Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2003-01-07 21:12:04


Peter Dimov wrote:
> From: "Larry Evans" <jcampbell3_at_[hidden]>
[snip]
>>Why not use the Delef approach as demonstrated in shared_cyclic_ptr to
>
> avoid
>
>>false positives altogether?
>
>
> I'm not familiar with Detlef's approach...
I'm pretty sure there a reference to it in some of the compare docs
or code in the files/shared_cyclic_ptr directory.
> does it require programmer
> support?
>

Yes. It requires declaration of a single static variable for each
class that's garbage collected. It looks like this:

   ip_descriptor_of<test_subj>
   ip_descriptor_of<test_subj>
::c_mk_descriptor
   ;

The c_mk_descriptor default CTOR creates a descriptor for test_subj.
This descriptor is accessed with:

    bridge_stk_proxiterator::ip_descriptor const& subj_desc
       = ip_descriptor_of<test_subj>::the_descriptor()

The iterator over smart pointers contained within an object of type,
test_subj, is created as follows:

    test_subj a_subj;
    bridge_stk_proxiterator subj_proxiter(subj_desc, &a_subj);

subj_proxiter iterates over all the shared_cyclic_ptr's and (hopefully
in the near future) all the unshared_cyclic_ptrs contained within
a_subj.


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