1 #ifndef CAL_REF_COUNTED_H
2 #define CAL_REF_COUNTED_H
5 #include "cal3d/platform.h"
30 template<
typename T>
friend T* explicitIncRef(T* p);
48 assert(m_refCount == 0 &&
"_refCount nonzero in destructor");
55 assert(m_refCount >= 0 &&
"_refCount is less than zero in incRef()!");
65 assert(m_refCount > 0 &&
66 "_refCount is less than or equal to zero in decRef()!");
67 if (--m_refCount == 0)
74 int getRefCount()
const
83 RefCounted(
const RefCounted& rhs);
84 RefCounted& operator=(
const RefCounted& rhs);
91 T* explicitIncRef(T* p)
97 inline void explicitDecRef(RefCounted* p)
A container-safe smart pointer used for refcounted classes.
Definition: refcounted.h:11
virtual ~RefCounted()
Protected so users of refcounted classes don't use std::auto_ptr or the delete operator.
Definition: refcounted.h:46
Derive from RefCounted to make your class have reference-counted lifetime semantics.
Definition: refcounted.h:28