WoopsiGfx 1.4
Nintendo DS 2D Graphics Library
|
#include <libwoopsigfx/include/woopsiarray.h>
Public Member Functions | |
WoopsiArray (s32 initialReservedSize=0) | |
~WoopsiArray () | |
const s32 | size () const |
void | push_back (const T &value) |
void | insert (const s32 index, const T &value) |
void | pop_back () |
void | erase (const s32 index) |
T & | at (const s32 index) const |
bool | empty () const |
void | clear () |
T & | operator[] (const s32 index) const |
Class providing a dynamic array; that is, an array that will automatically grow to accommodate new data. It provides a fast way to randomly access a list of data. Essentially, it provides the most important functionality of the STL vector class without any of the overhead of including an STL class.
If the data to be stored will store a lot of data that will predominantly be read sequentially, consider using the LinkedList class instead. Resizing the list is an expensive operation that will occur frequently when filling the array with large amounts of data. Adding new data to the linked list is very inexpensive.
WoopsiArray< T >::WoopsiArray | ( | s32 | initialReservedSize = 0 | ) | [inline] |
Constructor.
initialReservedSize | The initial capacity of the array. |
WoopsiArray< T >::~WoopsiArray | ( | ) | [inline] |
Destructor.
T & WoopsiArray< T >::at | ( | const s32 | index | ) | const [inline] |
Get a value at the specified location. Does not perform bounds checking.
index | The index of the desired value. |
void WoopsiArray< T >::clear | ( | ) |
Remove all data.
bool WoopsiArray< T >::empty | ( | ) | const [inline] |
Check if the array has any data.
void WoopsiArray< T >::erase | ( | const s32 | index | ) |
Erase a single value at the specified index
void WoopsiArray< T >::insert | ( | const s32 | index, |
const T & | value | ||
) |
Insert a value into the array.
index | The index to insert into. |
value | The value to insert. |
T & WoopsiArray< T >::operator[] | ( | const s32 | index | ) | const |
Overload the [] operator to allow array-style access.
index | The index to retrieve. |
void WoopsiArray< T >::pop_back | ( | ) |
Remove the last element from the array.
void WoopsiArray< T >::push_back | ( | const T & | value | ) |
Add a value to the end of the array.
value | The value to add to the array. |
const s32 WoopsiArray< T >::size | ( | ) | const [inline] |
Get the size of the array.