The Original CHomP Software
|
An auto_array template that mimics selected behaviors of the std::auto_ptr template, but releases the memory with delete[], and thus should be applied to arrays. More...
#include <autoarray.h>
Public Types | |
typedef T | element_type |
The type of the elements in the array. More... | |
Public Member Functions | |
auto_array (element_type *p=0) throw () | |
The constructor. More... | |
auto_array (auto_array &a) throw () | |
Copy constructor. More... | |
auto_array & | operator= (auto_array &a) throw () |
Assignment operator. More... | |
~auto_array () | |
The destructor. More... | |
element_type * | get () const throw () |
Returns the internally stored pointer to an array. More... | |
element_type * | release () throw () |
Releases the pointer and returns it. More... | |
void | reset (element_type *p=0) throw () |
Resets the object to hold another pointer. More... | |
Private Attributes | |
T * | ptr |
An auto_array template that mimics selected behaviors of the std::auto_ptr template, but releases the memory with delete[], and thus should be applied to arrays.
This template is based on what I found in the g++ header file "memory".
Definition at line 53 of file autoarray.h.
typedef T chomp::homology::auto_array< T >::element_type |
The type of the elements in the array.
Definition at line 60 of file autoarray.h.
|
inlineexplicit |
|
inline |
Copy constructor.
Definition at line 66 of file autoarray.h.
|
inline |
The destructor.
Definition at line 76 of file autoarray.h.
References chomp::homology::auto_array< T >::ptr.
|
inline |
Returns the internally stored pointer to an array.
Definition at line 84 of file autoarray.h.
References chomp::homology::auto_array< T >::ptr.
|
inline |
Assignment operator.
Definition at line 69 of file autoarray.h.
References chomp::homology::auto_array< T >::release(), and chomp::homology::auto_array< T >::reset().
|
inline |
Releases the pointer and returns it.
Definition at line 90 of file autoarray.h.
References chomp::homology::auto_array< T >::ptr.
Referenced by chomp::homology::auto_array< T >::operator=().
|
inline |
Resets the object to hold another pointer.
Definition at line 98 of file autoarray.h.
References chomp::homology::auto_array< T >::ptr.
Referenced by chomp::homology::auto_array< T >::operator=().
|
private |
Definition at line 56 of file autoarray.h.
Referenced by chomp::homology::auto_array< T >::get(), chomp::homology::auto_array< T >::release(), chomp::homology::auto_array< T >::reset(), and chomp::homology::auto_array< T >::~auto_array().