Boost logo

Boost :

From: Pavel Vasiliev (pavel_at_[hidden])
Date: 2003-02-03 08:31:35


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


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