table of contents
other versions
| UArray(3U) | InterViews Reference Manual | UArray(3U) |
NAME¶
UArray - dynamic array class
SYNOPSIS¶
#include <Unidraw/uarray.h>
DESCRIPTION¶
UArray implements a dynamic array, that is, one that grows as elementsare added. It can also act as a linked list, allowing insertion andremoval of objects, though the overhead for such operations isgenerally greater than that for conventional doubly-linked listimplementations. However, the overhead per stored object ispotentially much less for a UArray, and objects can be accessed byindex in constant time.
PUBLICOPERATIONS¶
- UArray(int = 16)
- Create a new UArray instance, optionally providing an estimate of itsmaximum size. While specifying the size is not required, supplying anaccurate estimate will improve performance.
- void*& operator[](int index)
- Overloading the brackets operator allows access to the UArray'selements with the standard array notation. Note that type informationis lost when retrieving objects from the UArray, requiring casting.
- void Insert(void*, int index)
- void Remove(int index)
- Insert and remove an object at a particular index, moving thesucceeding objects up or down one position as required.
- int Index(void*)
- Return the given object's index in the UArray, returning -1 if theobject does not appear in the UArray.
- int Count()
- Return the number of objects inserted in the UArray.
- void Clear()
- Clear the UArray, reducing the number of object it contains to zero.
| 6 August 1990 | Unidraw |