Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2003-01-30 18:25:06


Philippe A. Bouchard wrote:
[snip]
>
> Oh no, don't tell me GC_malloc was working this way ;)
>
> BTW gc_header *must* have (ip_descriptor *) ?
>
        
Only if you want to collect cycles or provide some other means for
accessing the arcs in the pointer graph. As a matter of fact, it may
be better to do somewhat like shared_ptr does, i.e. instead of storing
a ip_descriptor*, just store something like counted_base, where the
actual instance is a derived class, counted_impl<T>, which knows the
"real" type, T, of the object pointed to. Maybe just add another
virtual function to descriptor_of<T>, which does what the virtual
counted_base_impl<P,D>::dispose does. This would allow proper
destruction without a virtual destructor. IOW, the ip_descriptor* in
the gc_header substitutes for the virtual destructor. This is pretty
much of the top of my head, so, take it for what it's worth.


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