|
Boost : |
From: Larry Evans (jcampbell3_at_[hidden])
Date: 2002-09-07 10:56:15
Greg Colvin wrote:
>At 08:45 AM 9/7/2002, Larry Evans wrote:
>
>
>Tell me more about how you are using Lin's method.
>
>
>
>
Pretty much the same way I used it in my earlier
GarbageCollectionByTemplateSpecialization folder in files.
The main difference is that the internal pointers were pushed
onto a stack and then processed by the various phases in
Lin's method. Comparison with your cyclic_ptr showed this
was too slow, so I tried speeding it up. I did this using iterators.
The trick making an static member template where the template
argument was the iterator type. That way, it could handle stl
containers of shared_ptrs as well as individual shared_ptr. However,
vector, or any other stl container, cannot be used without modification.
This modification is implemented in the scoped_cyclic_container. For
the ip_offset_iterator internal pointer method, this is specialized as:
template
< template<typename>class Container
, template<typename>class Element
, gc_methods GcMethod
>
class
scoped_cyclic_container
< Container
, Element
, cyclic_count_gc<GcMethod,ip_offset_iterator>
>
: public obj_id
, public
Container<shared_cyclic_ptr<Element,cyclic_count_gc<GcMethod,ip_offset_iterator>
> >
, private detail::mk_proxiters_descriptor_static::proxiter_record
{...};
Container can be a stl container template. A similar specialization is
needed, I think,
for ip_assign_op_switch because it needs to assign to each element of
the container
in order to work. At least that was my experience.
Anyway, the shared_ptr and shared_count also were modified to allow
this. I could
post these if you want, or I could give further explanation. I realize
this is kinda sketchy,
but let me know and I try and be clearer.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk