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 elements are added. It can also act as a linked list, allowing insertion and removal of objects, though the overhead for such operations is generally greater than that for conventional doubly-linked list implementations. However, the overhead per stored object is potentially much less for a UArray, and objects can be accessed by index in constant time.

PUBLIC OPERATIONS

Create a new UArray instance, optionally providing an estimate of its maximum size. While specifying the size is not required, supplying an accurate estimate will improve performance.
Overloading the brackets operator allows access to the UArray's elements with the standard array notation. Note that type information is lost when retrieving objects from the UArray, requiring casting.
Insert and remove an object at a particular index, moving the succeeding objects up or down one position as required.
Return the given object's index in the UArray, returning -1 if the object 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