76 if (m_refCount != 0) {
77 std::cerr <<
"TODO: ~ReferenceCountable count != 0!\n";
90 int increase_refcount()
const 92 return (++ m_refCount);
101 int decrease_refcount()
const 103 return (-- m_refCount);
107 mutable int m_refCount;
133 m_p->increase_refcount();
156 m_p->increase_refcount();
170 if (
this != &other) {
172 if ((m_p = other.m_p) != NULL)
173 m_p->increase_refcount();
194 operator const T* ()
const 199 const T& operator *()
const 204 const T* operator ->()
const 231 std::ptrdiff_t diff = m_p - other.m_p;
245 return m_p == other.m_p;
258 return m_p != other.m_p;
271 if (m_p->decrease_refcount() <= 0)
281 #endif // REFCOUNT_PTR_H
refcount_ptr(const refcount_ptr &other)
Base class for reference countable objects.
ReferenceCountable()
Default constructor, which initializes the reference count to zero.
A template class representing a reference counted pointer.
bool IsNULL() const
Checks whether or not an object is referenced by the reference counted pointer.