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 <chomp/struct/autoarray.h>
Public Types | |
typedef T | element_type |
The type of the elements in the array. | |
Public Member Functions | |
auto_array (element_type *p=0) throw () | |
The constructor. | |
auto_array (auto_array &a) throw () | |
Copy constructor. | |
auto_array & | operator= (auto_array &a) throw () |
Assignment operator. | |
~auto_array () | |
The destructor. | |
element_type * | get () const throw () |
Returns the internally stored pointer to an array. | |
element_type * | release () throw () |
Releases the pointer and returns it. | |
void | reset (element_type *p=0) throw () |
Resets the object to hold another pointer. | |
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 54 of file autoarray.h.
typedef T chomp::homology::auto_array< T >::element_type |
The type of the elements in the array.
Definition at line 61 of file autoarray.h.
chomp::homology::auto_array< T >::auto_array | ( | element_type * | p = 0 ) |
throw () [inline, explicit] |
The constructor.
Definition at line 64 of file autoarray.h.
chomp::homology::auto_array< T >::auto_array | ( | auto_array< T > & | a ) | throw () [inline] |
Copy constructor.
Definition at line 67 of file autoarray.h.
chomp::homology::auto_array< T >::~auto_array | ( | ) | [inline] |
The destructor.
Definition at line 77 of file autoarray.h.
References chomp::homology::auto_array< T >::ptr.
element_type* chomp::homology::auto_array< T >::get | ( | ) | const throw () [inline] |
Returns the internally stored pointer to an array.
Definition at line 85 of file autoarray.h.
References chomp::homology::auto_array< T >::ptr.
auto_array& chomp::homology::auto_array< T >::operator= | ( | auto_array< T > & | a ) | throw () [inline] |
Assignment operator.
Definition at line 70 of file autoarray.h.
References chomp::homology::auto_array< T >::release(), and chomp::homology::auto_array< T >::reset().
element_type* chomp::homology::auto_array< T >::release | ( | ) | throw () [inline] |
Releases the pointer and returns it.
Definition at line 91 of file autoarray.h.
References chomp::homology::auto_array< T >::ptr.
Referenced by chomp::homology::auto_array< T >::operator=().
void chomp::homology::auto_array< T >::reset | ( | element_type * | p = 0 ) |
throw () [inline] |
Resets the object to hold another pointer.
Definition at line 99 of file autoarray.h.
References chomp::homology::auto_array< T >::ptr.
Referenced by chomp::homology::auto_array< T >::operator=().
T* chomp::homology::auto_array< T >::ptr [private] |
Definition at line 57 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().