AutoPtr< T, P > Class Template Reference#include <autoPtr.h>
Inheritance diagram for AutoPtr< T, P >: ![]() Detailed Description
A simple smart pointer.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Types | |
| typedef T | ValueType |
Public Member Functions | |
| AutoPtr (T *ptr=0) | |
| ~AutoPtr () | |
| AutoPtr (AutoPtr &rhs) | |
| template<class U> | |
| AutoPtr (AutoPtr< U, P > &rhs) | |
| AutoPtr & | operator= (AutoPtr &rhs) |
| Transfer ownership, any object currently be referenced is deleted and rhs is set to 0. | |
| template<class U> | |
| AutoPtr & | operator= (AutoPtr< U, P > &rhs) |
| T * | ptr () const |
| T & | operator * () const |
| T * | operator-> () const |
| T & | operator[] (size_t index) |
| T * | release () |
| Release ownership of the object without deleting it. | |
| void | reset (T *ptr=0) |
| Equivalent to *this = (T*)ptr, except that operator=(T*) isn't provided for. | |
| AutoPtr (AutoPtrRef< T > ref) | |
| AutoPtr & | operator= (AutoPtrRef< T > ref) |
| bool | isNull () const |
| bool | isValid () const |
| template<class U> | |
| operator AutoPtrRef () | |
| template<class U> | |
| operator AutoPtr () | |
Private Attributes | |
| T * | _ptr |
| AutoPtr< T, P >::AutoPtr | ( | T * | ptr = 0 |
) | [inline, explicit] |
| AutoPtr< T, P >::AutoPtr | ( | AutoPtr< T, P > & | rhs | ) | [inline] |
| AutoPtr< T, P >::AutoPtr | ( | AutoPtr< U, P > & | rhs | ) | [inline] |
| AutoPtr< T, P >::AutoPtr | ( | AutoPtrRef< T > | ref | ) | [inline] |
| AutoPtr& AutoPtr< T, P >::operator= | ( | AutoPtr< T, P > & | rhs | ) | [inline] |
Transfer ownership, any object currently be referenced is deleted and rhs is set to 0.
| AutoPtr& AutoPtr< T, P >::operator= | ( | AutoPtr< U, P > & | rhs | ) | [inline] |
| T* AutoPtr< T, P >::ptr | ( | ) | const [inline] |
| T& AutoPtr< T, P >::operator * | ( | ) | const [inline] |
| T* AutoPtr< T, P >::operator-> | ( | ) | const [inline] |
| T& AutoPtr< T, P >::operator[] | ( | size_t | index | ) | [inline] |
| T* AutoPtr< T, P >::release | ( | ) | [inline] |
Release ownership of the object without deleting it.
Equivalent to *this = (T*)ptr, except that operator=(T*) isn't provided for.
| AutoPtr& AutoPtr< T, P >::operator= | ( | AutoPtrRef< T > | ref | ) | [inline] |
| AutoPtr< T, P >::operator AutoPtrRef | ( | ) | [inline] |
| AutoPtr< T, P >::operator AutoPtr | ( | ) | [inline] |