Boost logo

Boost :

From: cppljevans_at_[hidden]
Date: 2003-10-10 19:29:22


On 10/10/2003 04:15 PM, Fernando Cacciola wrote:
> http://groups.yahoo.com/group/boost/files/shared_cyclic_ptr/new_policied.tar.gz
>
> I can't read .tar files in XP.
> If you can add a .zip I can look at it.
I added a smart_ptr.zip which contains the new_policied.cpp code as well
as a new test, smart_ptr.cpp, showing how to use with a policied smart
pointer. Hopefully it can be adapted for use with David Held's code.
Anyway, it highlights the memory advantages of the shifted_ptr method.
The only advantage is w.r.t. the number of vertices. As shown by
smart_ptr.cpp, the memory required is E*2*sizeof(void*) (where E =
the number of "Edges" [pointers] in the pointer graph) which is
the same as for hared_ptr), + V*(sizeof(vtbl*)+sizeof(deleter*)+
2*sizeof(refcount)) which, compared with that shown in compare_mem.zip,
shows an size advantage over shared_ptr of 1 sizeof(void*). The
uploaded code did not include room for the deleter or weak count, but
I added them in the above analysis.

Fernando, I had another problem with the preprocessor macros. If you
look at the code just uploaded, you'll note some duplication of
code. The 2 macros:

   BOOST_DEFINE_NEW_POLICIED_CTOR_OVERLOAD
   BOOST_DEFINE_NEW_POLICIED_POL_REF_CTOR_OVERLOAD

are almost the same. I tried creating another macro with the common
elements; however, it didn't work. Is there some way of doing
this to save duplicate coding?


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