class autoptr

Declared in <XAutoPtr.h>

Automatic pointer, like auto_ptr, except that I did it myself.

The rules are simple: this is a substitute for Tptr, except that I cannot manipulate the pointer, I cannot copy to another pointer, and I must either explicitly release the pointer to the world (like TWindow objects) or return the value--both cause this pointer to become NULL.


Construction/Destruction

autoptr::autoptr
autoptr::operator =
autoptr::~autoptr

Access To Pointer

autoptr::operator !
autoptr::operator !=
autoptr::operator !=
autoptr::operator *
autoptr::operator ->
autoptr::operator ==
autoptr::operator ==

Pointer Processing

autoptr::Detach
autoptr::Ptr
autoptr::Return


Construction/Destruction

autoptr::autoptr

Usage: autoptr(T*ptr=NULL)

Construction Class. This creates an automatic pointer on the stack. This can be initialized with an object or without.

autoptr::operator =

Usage: const autoptr&operator=(T*ptr)

Initializes this with a pointer.

autoptr::~autoptr

Usage: ~autoptr()

Destruction class. If this still points to an object, this calls the object's destructor. This makes this an exception safe mechanism for storing temporary pointers.

Access To Pointer

autoptr::operator !

Usage: int operator!()

This returns true if the pointer is NULL.

autoptr::operator !=

Usage: int operator!=(const T*a)

This returns true if two pointers are not equal.

autoptr::operator !=

Usage: int operator!=(const autoptr&ptr)

This returns true if two pointers are not equal.

autoptr::operator *

Usage: T&operator*()

This emulates the normal operator to permit access to the contents of a class or structure.

autoptr::operator ->

Usage: T*operator-tr&o()

This emulates the normal -> operator to allow access to fields in a class or structure.

autoptr::operator ==

Usage: int operator==(const T*a)

This returns true if two pointers are equal.

autoptr::operator ==

Usage: int operator==(const autoptr&ptr)

This returns true if two pointers are equal.

Pointer Processing

autoptr::Detach

Usage: void Detach()

No comment provided

autoptr::Ptr

Usage: T*Ptr()

No comment provided

autoptr::Return

Usage: T*Return()

No comment provided