|
MADNESS
version 0.9
|
Scoped pointer. More...
#include <scopedptr.h>
Public Types | |
| typedef ptrT | element_type |
| the pointer type More... | |
Public Member Functions | |
| ScopedPtr (ptrT *p=NULL) | |
| Construct a scoped pointer. More... | |
| ~ScopedPtr () | |
| Destructor. More... | |
| void | reset (ptrT *p=NULL) |
| Reset the current pointer. More... | |
| ptrT & | operator* () const |
| Dereference operator. More... | |
| ptrT * | operator-> () const |
| Pointer member accessor. More... | |
| ptrT * | get () const |
| Pointer accessor. More... | |
| operator bool () const | |
bool conversion operator More... | |
| bool | operator! () const |
| Not operator. More... | |
| void | swap (ScopedPtr< ptrT > &other) |
| Swap the pointers. More... | |
Scoped pointer.
Holds a pointer until it goes out of scope, then automatically deletes it. A scoped pointer should be used to wrap pointers where the lifetime of the pointer should be limited to a specific scope. The pointer cannot be copied. The pointer will be deleted with the delete operator.
| ptrT | The pointer type |
ptrT must be a complete type | typedef ptrT madness::ScopedPtr< ptrT >::element_type |
the pointer type
|
inlineexplicit |
Construct a scoped pointer.
| p | The pointer to hold [default = NULL] |
| nothing |
|
inline |
Destructor.
calls delete operator
|
inline |
|
inline |
bool conversion operator
| nothing |
|
inline |
Not operator.
| nothing |
|
inline |
Dereference operator.
| madness::MadnessException | If the pointer is NULL |
|
inline |
Pointer member accessor.
| madness::MadnessException | If the pointer is NULL |
|
inline |
Reset the current pointer.
This will destroy the current pointer. If an new pointer is provided this pointer will be set to that value.
| p | The pointer that will replace this pointer after deletion |
| madness::MadnessException | If p is the same as this pointer, except when this pointer is NULL. |
References madness::ScopedPtr< ptrT >::swap().
|
inline |
Swap the pointers.
| other | The pointer to swap with this pointer |
| nothing |
Referenced by madness::ScopedPtr< ptrT >::reset(), and madness::swap().
1.8.8