AutoPtr

Engine/source/core/util/autoPtr.h

A simple smart pointer.

More...

Public Types

T
ValueType 

Private Attributes

T *

Public Functions

AutoPtr(AutoPtr< U, P > & rhs)
AutoPtr(T * ptr)
bool
bool

Transfer ownership, any object currently be referenced is deleted and rhs is set to 0.

operator=(AutoPtr< U, P > & rhs)
T &
operator[](size_t index)
T *
ptr()
T *

Release ownership of the object without deleting it.

reset(T * ptr)

Equivalent to this = (T)ptr, except that operator=(T*) isn't provided for.

Detailed Description

A simple smart pointer.

An extended version of std::auto_ptr which supports a deletion policy. The delete policy indicates how the ptr is to be deleted. DeleteSingle, the default, is used to delete individual objects. DeleteArray can can be used to delete arrays.

 AutoPtr ptr(new Object); AutoPtr ptr(new Object); AutoPtr ptr(new Object[10]); AutoPtrs do not perform reference counting and assume total ownership of any object assigned to them. Assigning an AutoPtr to another transfers that ownership and resets the source AutoPtr to 0.

Public Types

typedef T ValueType 

Private Attributes

T * _ptr 

Public Functions

AutoPtr(AutoPtr & rhs)

AutoPtr(AutoPtr< U, P > & rhs)

AutoPtr(AutoPtrRef< T > ref)

AutoPtr(T * ptr)

~AutoPtr()

isNull()

isValid()

operator AutoPtr< U, P>()

operator AutoPtrRef< U>()

operator*()

operator->()

operator=(AutoPtr & rhs)

Transfer ownership, any object currently be referenced is deleted and rhs is set to 0.

operator=(AutoPtr< U, P > & rhs)

operator=(AutoPtrRef< T > ref)

operator[](size_t index)

ptr()

release()

Release ownership of the object without deleting it.

reset(T * ptr)

Equivalent to this = (T)ptr, except that operator=(T*) isn't provided for.