#include <gldynarray.h>
Public Methods | |
unsigned | NotFound () const |
Returned by failed search. | |
bool | Empty () const |
Returns true if this contains nothing. | |
void | Clear () |
delete the contents of this array. | |
T & | operator[] (unsigned i) const |
Array access. | |
T * | Memory () |
Access to the base of array memory. | |
T | Item (unsigned i) const |
Fetch an item, by reference, at the index given. | |
T * | ItemPointer (unsigned i) const |
Fetch an item, by pointer, at the index given. | |
void | SetItem (unsigned i, const T &t) |
Set the item at the given index. | |
unsigned | Count () const |
The number of items in the array. More... | |
unsigned | AllocatedSize () const |
The allocated memory, in total number of items. | |
void | SetCount (unsigned _count) |
Set the number of items in the array. More... | |
unsigned | PushBack (const T &t) |
Push T to the last element of the array. More... | |
T | Back () |
Get the last element. | |
T | PopBack () |
Pop the last element of the array. More... | |
void | Insert (T t, unsigned n) |
Insert an element into this array at index 'n'. More... | |
void | Remove (unsigned n) |
Remove the element at index 'n'. More... | |
unsigned | Find (const T &t) const |
Trys to find the selected item (criteria being t == data[i]) returns an index if successful, NOTFOUND if not. | |
bool | FindAndDelete (const T &t) |
Trys to find the selected item (criteria being t == data[i]) and delete it. | |
void | Resize (unsigned _size) |
Resize the array. More... | |
void | ResizePower2 (unsigned _size) |
A more useful and efficient resize. More... | |
void | Append (const GlDynArray< T > &rhs) |
Appends another DynArray (of the same type) on to this one. More... | |
void | Sort () |
Perform a shellsort on the array. More... |
Has a notion of both Size (the allocated memory) and Count (the number of items.) Generally, as a user of the array you want to be sure you are using Count.
Left to its own devices, GlDynArray will use power of 2 memory allocation when it expands.
|
Appends another DynArray (of the same type) on to this one. The appended array is unchanged. Uses PowerOf2 allocation in hopes of optimizing multiple appends. |
|
The number of items in the array. (Managed by the user.) |
|
Insert an element into this array at index 'n'. Will resource and adjust count as necessary. |
|
Pop the last element of the array. Will never change the size of allocated memory, but will update the count. |
|
Push T to the last element of the array. Will never reduce the size, only increase it. (Useful for setting the size to something reasonable, and then pushing items to the array. Will increment count. |
|
Remove the element at index 'n'. Adjusts count as necessary. Won't reduce memory. |
|
Resize the array. Will take no action of the array size does not change. Will not increase count. |
|
A more useful and efficient resize. Note resize normally does not need to be called, since it will be called by other functions. |
|
Set the number of items in the array. This will also re-allocate memory. |
|
Perform a shellsort on the array. Note that "Find" is not cordinated with the sort, so Find will still be in linear time. |