Public Member Functions | |
void | add (T a) |
Function to add an element to an array. | |
void | add (T *a) |
void | trim () |
Function to trim an array to exactly the right size. | |
void | grow (int size) |
ap_array (int size_) | |
Constructor which specifies the initial array size. | |
ap_array () | |
Default constructor. | |
~ap_array () | |
Destructor. | |
Public Attributes | |
T * | data |
The data for the array. | |
int | size |
The number of locations which exist in the array. | |
int | n |
The number of valid data items currently in the array. |
|
Constructor which specifies the initial array size.
|
|
Default constructor. It defaults to array size 10. |
|
Destructor. It deletes the allocated array. |
|
Function to add an element to an array. The array will grow to twice the needed size when the array is too small to add a new item.
|
|
|
|
Function to trim an array to exactly the right size. After adding items to an array, it may be almost twice as big as it needs to be. Using trim you can shrink it back to its proper size. It actually creates a new array and copies the data. |
|
|
|
The data for the array.
|
|
The number of locations which exist in the array.
|
|
The number of valid data items currently in the array.
|