Public Types | Public Member Functions | Private Attributes

chomp::homology::auto_array< T > Class Template Reference

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>

List of all members.

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_arrayoperator= (auto_array &a) throw ()
 Assignment operator.
 ~auto_array ()
 The destructor.
element_typeget () const throw ()
 Returns the internally stored pointer to an array.
element_typerelease () 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

Detailed Description

template<typename T>
class chomp::homology::auto_array< T >

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.


Member Typedef Documentation

template<typename T>
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.


Constructor & Destructor Documentation

template<typename T>
chomp::homology::auto_array< T >::auto_array ( element_type p = 0 ) throw () [inline, explicit]

The constructor.

Definition at line 64 of file autoarray.h.

template<typename T>
chomp::homology::auto_array< T >::auto_array ( auto_array< T > &  a ) throw () [inline]

Copy constructor.

Definition at line 67 of file autoarray.h.

template<typename T>
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.


Member Function Documentation

template<typename T>
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.

template<typename T>
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().

template<typename T>
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=().

template<typename T>
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=().


Member Data Documentation

template<typename T>
T* chomp::homology::auto_array< T >::ptr [private]

The documentation for this class was generated from the following file: