I would like to offer for discussion one more implementation of
reference counting smart pointer. It has taken much of the design
from boost::shared_ptr/weak_ptr and is quite similar to it, but
supports different types of reference counting (intrusive, semi-
intrusive, non-intrusive + weak references, dummy reference
counting) within a single smart pointer class. The library is also
more performance-oriented and has extra tools implemented.

Please find more info in the Readme at
http://groups.yahoo.com/group/boost/files/refc/Readme.html

I am not sure that there is a place for another one smart pointer
library in Boost. That is why I have not made complete
"boostification". Nevertheless I would be grateful for any comment
that will help it to mature.

Files:
Readme:
http://groups.yahoo.com/group/boost/files/refc/Readme.html
Q&A:
http://groups.yahoo.com/group/boost/files/refc/Refc_library_Q&A.html
Complete package:
http://groups.yahoo.com/group/boost/files/refc/refc_ptr.zip
(About 63K. Includes examples and preliminary documentation)


Also there is a question related to boost::shared_ptr: what the
drawbacks would be in implementing it via void*? I mean

template<class T> class shared_ptr
{
  void * px;
  detail::shared_count pn;
...
public:
  T * get() const
  {
     return static_cast<T*>(px);
  }
}

The advantage is that with void*-based implementation all
shared_ptr<>’s are layout-compatible and thus std containers may
be specialized for shared_ptr to reduce code bloat (since not all
linkers are as smart as MSVC++).

Probably this was already discussed and declined. Currently I see
the two issues: slight performance degradation on some platforms
(which platforms?) and prohibition of the get() method for
incomplete types. What else?


Pavel

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to