2 #ifndef _SCOPED_ARRAY_CPP_ 3 #define _SCOPED_ARRAY_CPP_ 108 template <
typename T>
123 template <
typename T>
125 : t_ (t), refcount_ (1)
129 template <
typename T>
virtual ~ScopedArray(void)
Dtor will delete pointer if refcount becomes 0.
T * t_
Pointer to the object that's being reference counted.
Shim * ptr_
Pointer to the Shim.
void increment(void)
implementation of the increment operation
T * get(void)
get the underlying pointer
ScopedArray(void)
default Ctor
void decrement(void)
implementation of the decrement operation
int refcount_
Current value of the reference count.
T * get_ptr(void)
get the underlying pointer
void operator=(T *ptr)
assignment operator for times when you don't want the reference increased for incoming ptr ...
A shim class that keeps track of the reference count and a pointer to the type T that's reference cou...
This template class provides transparent reference counting of its template parameter T...