template<typename U>
RefPtr<T> &RefPtr<T>::assign(const RefPtr<U> &p)
{
+ if(static_cast<const void *>(&p)==this)
+ return *this;
+
decref();
data = p.data;
counts = p.counts;
template<typename U>
WeakPtr<T> &WeakPtr<T>::assign(const WeakPtr<U> &p)
{
+ if(&p==this)
+ return *this;
+
decref();
data = p.get();
counts = (data ? p.counts : nullptr);