Next: Method of use
Up: ResizeArray
Previous: Internal data structures
- int num(void) - return the external size of the array.
- T& item(int N) - return (as an lvalue) the Nth item in the
array. If N is larger than the internal size of the array, the size of
the array will be automatically increased by the current resize factor.
- T& operator[](int N) - same as item, just a nicer
form (this really makes it look like a regular array. In fact, you can
have 2D and 3D resizing arrays by using this operator, and declaring
a template of a template).
- int append(const T&) - append the given data at the end of
the array, resizing it if necessary. Returns the index of the item.
- int insert_after(int, const T&) - inserts the given data in
the location following the given index. If the given index is less than
0, this puts the item at the beginning of the array. If the given index
is larger than the external size, this puts the item at the end of the
array. Returns the index of the item.
- int insert_before(int, const T&) - inserts the given data in
the location just before the given index. If the given index is less than
0, this puts the item at the beginning of the array. If the given index
is larger than the external size, this puts the item at the end of the
array. Returns the index of the item.
- void remove(int M= -1, int N= -1) - removes the items with
index M ... N, with all items in array positions below this region moved
up to fill the resulting hole. If both arguments are negative, this
removes ALL the array items. If the second argument is negative, only
item M is removed.
- int find(const T&) - scans the array for an element which
matches the given argument, and returns the index of the first matching
item found. If no match is found, this returns -1.
Next: Method of use
Up: ResizeArray
Previous: Internal data structures
Justin Gullingsrud
Tue Apr 6 09:26:48 CDT 1999