---
name: "UArray"
section: "3"
platform: "linux"
package: "ivtools-dev"
version: "1.1.3-4"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/UArray"
---

# UArray(3)

dynamic array class

## 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

- **UArray(int = 16)**

  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.

- **void\*& operator\[\](int index)**

  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.

- **void Insert(void\*, int index)**

  - **void Remove(int index)**

  Insert and remove an object at a particular index, moving the succeeding objects up or down one position as required.

- **int Index(void\*)**

  Return the given object's index in the UArray, returning -1 if the object 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.
