class AutoRelease
Defined in:
A helper class the wraps a pointer to a shared object.
TSTools.h
Definition
template <class type> class AutoRelease
Template Parameters
type |
The type of object to which the AutoRelease object refers.
|
Constructor
explicit AutoRelease(type *ptr);
Parameters
ptr |
A pointer to the shared object that is wrapped by the AutoRelease object.
|
Description
The AutoRelease
class template is a helper class that wraps a pointer to a shared object. When an AutoRelease
object is destroyed (usually by going out of scope), the Release
function is automatically called for the object that was passed into the ptr
parameter when the AutoRelease
object was constructed.An
AutoRelease
object behaves like a pointer to an object of the type given by the type
template parameter. An AutoRelease
object can be passed as a function parameter wherever a pointer to type
is expected, and the ->
operator can be used to access members of the object that the AutoRelease
object wraps.
See Also