Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2002-07-30 15:49:07


David B. Held wrote:

>"Philippe A. Bouchard" <philippeb_at_[hidden]> wrote in message
>news:ai6r2j$534$1_at_main.gmane.org...
>
>>[...]
>>ptr<Derived> pD = new Derived;
>>ptr<Derived, X> pX = new X;
>>ptr<Derived, Y> pY = new Y;
>>
>>pX = pD; // Won't work
>>pY = pD; // Won't work
>>[...]
>>
>
>Of course, this syntax is clumsier than existing pointers, and also less
>powerful. For instance, you may have code that knows about X or Y,
>but not about anything derived from X or Y. Your proposal requires
>such code to know about all possible derivatives in order to work
>properly, which is a fairly restrictive requirement.
>
>Dave
>
The Boehm collector is able to find the beginning of an object given a
pointer
to the interior of that object. Could Boehm's method be adapted here so
that,
when trying to find the reference count, the Boehm method could be used to
find the beginning of the object where the refcount is located, as
assured by, for
example, a special gc allocator? WARNING: I haven't thought carefully about
this.

OTOH, this would probably make the overhead of reference count update
significantly
slower, but I can't be really sure since I'm unfamiliar with Boehm's method.
See http://www.hpl.hp.com/personal/Hans_Boehm/gc/ for details.


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