>> The advantage is that with void*-based implementation... > There are no significant drawbacks that I can see.
> The only drawback is that with a void * px it's easier to create a broken > implementation that will almost work. For example > template<class Y> shared_ptr<T>::shared_ptr(shared_ptr<Y> const & rhs): > px(rhs.px), pn(rhs.pn) {} > is buggy, and should now be > template<class Y> shared_ptr<T>::shared_ptr(shared_ptr<Y> const & rhs): > px(static_cast<T*>(rhs.get())), pn(rhs.pn) {} Yes, this needs much care. One must use something like: // Will not compile if there is no implicit conversion from U* to T*. template <typename T, typename U> inline T* implc(U *pU) // nothrow { return pU; } (this is taken from the implementation of refc_ptr) and then template<class Y> shared_ptr<T>::shared_ptr(shared_ptr<Y> const & rhs): px(implc<T>(rhs.get())), pn(rhs.pn) {} Since the smart pointers are especially useful when stored in std containers instead of raw pointers, may be it worth troubles to specialize containers for their void*-based versions? Both boost::shared_ptr and my (newly proposed) refc_ptr potentially allow this. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost