+ template<typename U>
+ RefPtr &operator=(const RefPtr<U> &p) { return assign(p); }
+
+ template<typename U>
+ RefPtr &operator=(const WeakPtr<U> &p) { return assign(RefPtr(p)); }
+
+private:
+ template<typename U>
+ RefPtr &assign(const RefPtr<U> &);
+
+public:
+ /** Makes the RefPtr release its reference of the data without deleting it.
+ Note that if there are other RefPtrs left with the same data, it might
+ still get deleted automatically. */
+ T *release();
+
+ /** Marks the data to not be deleted. This affects all RefPtrs with the
+ same data. */
+ void keep() { if(counts) counts->count |= RefCounts::KEEP; }
+
+ T *get() const { return data; }
+ T &operator*() const { return *data; }