refcount_ptr.h Source File
Back to the index.
Go to the documentation of this file.
78 if (m_refCount != 0) {
79 std::cerr <<
"TODO: ~ReferenceCountable count != 0!\n";
92 int increase_refcount()
const
94 return (++ m_refCount);
103 int decrease_refcount()
const
105 return (-- m_refCount);
109 mutable int m_refCount;
135 m_p->increase_refcount();
158 m_p->increase_refcount();
172 if (
this != &other) {
174 if ((m_p = other.m_p) != NULL)
175 m_p->increase_refcount();
196 operator const T* ()
const
233 std::ptrdiff_t diff = m_p - other.m_p;
247 return m_p == other.m_p;
260 return m_p != other.m_p;
273 if (m_p->decrease_refcount() <= 0)
283 #endif // REFCOUNT_PTR_H
bool IsNULL() const
Checks whether or not an object is referenced by the reference counted pointer.
refcount_ptr(const refcount_ptr &other)
bool operator<(const refcount_ptr &other) const
Less-than operator, e.g. for sorting.
bool operator!=(const refcount_ptr &other) const
Not-Equals operator.
A template class representing a reference counted pointer.
refcount_ptr & operator=(const refcount_ptr &other)
bool operator==(const refcount_ptr &other) const
Equals operator.
ReferenceCountable()
Default constructor, which initializes the reference count to zero.
Base class for reference countable objects.
Generated on Tue Aug 25 2020 19:25:06 for GXemul by
1.8.18