PSCF v1.1
|
A very simple RAII pointer. More...
#include <ScopedPtr.h>
Public Types | |
typedef T | element_type |
Type of object pointed to. More... | |
Public Member Functions | |
ScopedPtr (T *p=0) | |
Constructor. More... | |
~ScopedPtr () | |
Destructor, destroys object pointed to, if any. More... | |
void | reset (T *p=0) |
Acquire ownership of a built-in pointer. More... | |
T & | operator* () const |
Dereference. More... | |
T * | operator-> () const |
Member access. More... | |
T * | get () const |
Return enclosed built-in pointer. More... | |
A very simple RAII pointer.
A ScopedPtr mimics a built-in pointer, except that guarantees destruction of the object to which it points when the ScopedPtr goes out of scope. It accepts ownership of a built-in pointer either upon construction or by the reset() method, and deletes the associated object in its destructor. A ScopedPtr cannot be copy constructed or assigned.
Similar to boost::scoped_ptr, with minor differences. It takes the same amount of memory as a built-in pointer, and should be equally fast.
Definition at line 29 of file ScopedPtr.h.
typedef T Util::ScopedPtr< T >::element_type |
Type of object pointed to.
Definition at line 35 of file ScopedPtr.h.
|
inlineexplicit |
Constructor.
Definition at line 38 of file ScopedPtr.h.
|
inline |
Destructor, destroys object pointed to, if any.
Definition at line 42 of file ScopedPtr.h.
|
inline |
Acquire ownership of a built-in pointer.
p | built-in pointer to acquire. |
Definition at line 54 of file ScopedPtr.h.
|
inline |
Dereference.
Definition at line 63 of file ScopedPtr.h.
|
inline |
Member access.
Definition at line 67 of file ScopedPtr.h.
|
inline |
Return enclosed built-in pointer.
Definition at line 71 of file ScopedPtr.h.
Referenced by Util::isNull().