Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2004-11-11 14:29:42


Larry Evans wrote:

> On 11/10/2004 07:52 PM, David Abrahams wrote:
>
>> "George van den Driessche" <grebe_at_[hidden]> writes:
>>
>>>
> [snip]
>
>>> (a) Reflect C++ types into C++ objects. Each type for which you
>>> provide a
>>> reflection map will correspond to exactly one property_set object, which
>>> would contain a set of property_type_info objects.
>
> [snip]
>
>> (e) Serialise the types, using results of (a).
>
> [snip]
>
>> order to do serialization in that way, you'd likely have to expose an
>> object's guts: its implementation details.
>
>
> If you could "reflect" all the reference counted smart_ptrs, like
> shared_ptr, for a class, T, into some class specific structure, say
> gc_desc<T>, then you could use this for precise garbage collection,
> AFAICT. Although it does expose the guts (after all, shared_ptr<X>,
> might be private in T), this is what you'd need to detect cycles.

A "faster" way to infer cycles for pointers could be done with a bit
more information on the shared_ptr. If you keep a set of object memory
spans (heap address, and class sizeof) for all shared instances you can
find all shared_ptrs that fall within those shared instances. With that
you can build the reference graph to detect the cycles.

> Does this seem a reasonable additional use for (a)?

Seems like overkill to me :-) -- Especially give how compiler intensive
generating the reflection information is.

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq

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