Scroll to navigation

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

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.
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.
Insert and remove an object at a particular index, moving thesucceeding objects up or down one position as required.
Return the given object's index in the UArray, returning -1 if theobject does not appear in the UArray.
Return the number of objects inserted in the UArray.
Clear the UArray, reducing the number of object it contains to zero.
6 August 1990 Unidraw