Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2002-08-29 16:58:42


Philippe A. Bouchard wrote:

>Greg Colvin wrote:
>
>
>
>>Which is what makes it possible to retrieve the counter, given
>>a pointer into the object, or vice versa. Or at least to do it
>>quickly. OK. But then I still say that ptr<T> can just hold an
>>actual T*, and the rest of Phillippe's machinery should be
>>unnecessary.
>>
>>
>
>1) Click on the following:
>http://groups.yahoo.com/group/boost/files/ptr/ptr.hpp
>
>2) It's not [...] as before [...] was sim-pli-fied.
>
>
>
The recent changes to ptr.hpp removed the static vector of
offsets from the start of the object. These were simply replaced
with calls to dynamic_cast<void*>(T*) and then a pointer
adjustment to get to the reference count. So the latest changes,
as far as I can see, do just about what Greg suggests. Since each
reference count adjustment is now slowed down by a call to
dynamic cast, new benchmarks results would be useful. Also,
it would be useful to compare the space usage in terms of
vertices, V, and arcs, A, in the pointer graph. For ptr, I think it's
     V*sizeof(refcount) + A*0
The A*0 is because the sizeof (T*) is not counted since it's the same
size used by a raw pointer. The above figure is for just the additional
space. The virtual function table(allowing use of dynamic cast) is not
included in the V factor because the assumption is that all objects
pointed to already have virtual functions.


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