[Home] [Prev] [Next] [Up]
XGDynArray template
Provides a simple version of the dynamic array template from the Standard C++ library.
Usage:
#include <XString.h>
template XGDynArray<class T>;
Description
This provides similar functionality to the dynamic array template. This allows the creation and maintainance of a dynamic array of objects which have a copy operator.
Construction/Destruction Methods
XGDynArray::XGDynArray()
Default constructor creates an empty array.
XGDynArray::~XGDynArray()
Releases the data in this dynamic array.
Array manipulation
void XGDynArray::Insert(long i, const T&item)
Inserts the object item at the location in the array specified. This inserts the item before the zero-indexed element in the dynamic array. If i is equal to the length of the array, this appends the item to the end.
void XGDynArray::Delete(long i)
This deletes the specified item from the array.
long XGDynArray::Length(void)
Returns the number of items in this array.
XGDynArray<T> &XGDynArray::operator += (const T& item)
This appends the item to the end of the array. This allows the following expression to be written:
XGDynArray<Thing> array;
array += item;
T & XGDynArray::operator [] (long i)
This returns a reference to the element specified.