#include <Array.hpp>
Inheritance diagram for Array< T >:

Public Member Functions | |
| long | Length () const |
| Returns the current length of the array. | |
| T * | Entries () |
| Returns the pointer to the raw array used to store the elements. | |
| void | Release () |
| Releases the allocated memory. | |
| void | Reset (long new_length, T *mem=NULL) |
| Sets a new length. | |
| void | ReSize (long new_length) |
| Resizes the array but copies its first elements. | |
| const T & | operator[] (long i) const |
| The const indexation. | |
| T & | operator[] (long i) |
| The indexation. | |
| Array< T > & | operator= (const Array< T > &src) |
| Standard assignment. | |
| Array< T > & | operator= (const T &value) |
| Sets constant values to all the elements. | |
| bool | operator== (const Array< T > &array) |
| Compares two arrays. | |
| void | SetZero () |
| Sets all the elements to zero. | |
| T | Min () const |
| Find the minimum element. | |
| T | Max () const |
| Find the maximum element. | |
| Array () | |
| Creates a zero length array (allocates no memory). | |
| Array (long the_length, T *mem=NULL) | |
| Creates array of a given length. | |
| Array (const Array< T > &array) | |
| Duplicates an existing object. | |
| ~Array () | |
| Destructor: Releases the memory if it was allocated. | |
Protected Attributes | |
| T * | elements |
| long | length |
| bool | alloced |
Array<T> is an variable size array of elements of type <T>. The class Array<T> provides the main indexing tools, assignment operators etc. T may be any type. Depending on what member functions of Array<T> are really used and instantiated, further assumptions may be imposed on T (like the defined operators < and > for Array<T>Min and Array<T>Max etc.).
It is possible to use this class with a separately allocated array of memory. Then alloced is set to zero and the memory is not released by the functions or the destructor. Note however that '=' and 'Resize' would nevertheless allocate a new memory array unless the new size is not equal to the old one.
Creates a zero length array (allocates no memory).
Creates array of a given length.
| [in] | the_length | The new length. |
| [in] | mem | The memory to place the elements (optional). |
Duplicates an existing object.
| [in] | array | The source array. |
Destructor: Releases the memory if it was allocated.
| long Array< T >::Length | ( | ) | const [inline] |
Returns the current length of the array.
| T* Array< T >::Entries | ( | ) | [inline] |
Returns the pointer to the raw array used to store the elements.
| void Array< T >::Release | ( | ) | [inline] |
Releases the allocated memory.
| void Array< T >::Reset | ( | long | new_length, | |
| T * | mem = NULL | |||
| ) | [inline] |
Sets a new length.
| [in] | new_length | The new length. |
| [in] | mem | The memory to place the elements (optional). |
| void Array< T >::ReSize | ( | long | new_length | ) | [inline] |
Resizes the array but copies its first elements.
| [in] | new_length | The new length. |
| const T & Array< T >::operator[] | ( | long | i | ) | const [inline] |
The const indexation.
| [in] | i | The index starting from 0. |
| T & Array< T >::operator[] | ( | long | i | ) | [inline] |
The indexation.
| [in] | i | The index starting from 0. |
Standard assignment.
Duplicates an existing Array<T>.
| [in] | src | the existing array to duplicate |
Sets constant values to all the elements.
| [in] | value | The new value for the elements. |
Compares two arrays.
The equality relation for the arrays.
| [in] | array | The other array. |
| void Array< T >::SetZero | ( | ) | [inline] |
Sets all the elements to zero.
| T Array< T >::Min | ( | ) | const [inline] |
Find the minimum element.
| T Array< T >::Max | ( | ) | const [inline] |
Find the maximum element.
the length of 'elements' in sizeof(T) units; may be 0
true if 'elements' have been allocated using 'new'
1.5.2