Rudiments
|
#include <dynamicarray.h>
Inherits arraycollection< valuetype >.
The dynamicarray class allows you to store an arbitrary number of values and access them with array-like syntax.
Internally, the class stores these values in a series of extents. The size of the initial and incremental extents are defined in the constructor.
"valuetype" can be any scalar type, including a pointer, but cannot be an array.
Ie. these are legal: dynamicarray<int> d; dynamicarray<myclass> d; dynamicarray<myclass *> d;
These are not legal and whether they work or even compile would be platform-dependent: dynamicarray<int[100]> d; dynamicarray<myclass[100]> d; dynamicarray<myclass *[100]> d;
However, it is possible to create an array of arrays by nesting dynamicarrays and/or staticarrays, like:
dynamicarray<dynamicarray<int> > d; dynamicarray<dynamicarray<myclass> > d; dynamicarray<dynamicarray<myclass *> > d; dynamicarray<staticarray<int> > d; dynamicarray<staticarray<myclass> > d; dynamicarray<staticarray<myclass *> > d;
NOTE: If "valuetype" is a pointer and either of collection::setManageValues(true) or collection::setManageArrayValue(true) are called, then all elements of the dynamicarray prior to the highest set element must also be set to something.
For example, if element 9 is set to some value then elements 0-8 must also be set to some value. They may be set to 0 or NULL, but they must be set.
Otherwise attempts to delete the uninitialized elements during calls to clear() or the destructor will likely cause the program to crash.
|
inline |
Creates an empty instance of the dynamicarray class.
|
inline |
Creates an empty instance of the dynamicarray class. The initial extent will be created with "initiallength" members and each successive extent will be created with "incrementlength" members.
|
inline |
Creates an instance of the dynamicarray class that is a copy of "v".
|
inline |
Creates an instance of the dynamicarray class that is a copy of "v".
|
inline |
Deletes this instance of the dynamicarray class and all of its values.
|
inlinevirtual |
|
inline |
Clears the array and resets the lengths of the initial and incremental extents.
|
inlinevirtual |
Returns the number of elements in the array.
Implements collection.
|
inline |
Makes this instance of the dynamicarray class identical to "v".
|
inline |
Makes this instance of the dynamicarray class identical to "v".
|
inlinevirtual |
Provides read/write access to the "index"th element of the dynamicarray.
Implements arraycollection< valuetype >.
|
inline |
Sets all bytes of the first "count" elements of the dynamicarray to "value".
|
inline |
Sets all bytes of "count" elements of the dynamicarray, starting at "start", to "value".
|
inline |
Sets all bytes of the first "count" elements of the dynamicarray to 0.
|
inline |
Sets all bytes of "count" elements of the dynamicarray, starting at "start", to 0.