Array

Module: ecereCOM
Namespace: ecere::com
Type: Class
Base Class: Container

Description

A dynamically resizable array template

Properties and Members

  arrayT *Pointer to the storage for the array
  countuintThe number of elements in the array. Setting this value does NOT allocat storage. Be careful setting this and using Add() on the same Array.
  minAllocSizeuint
  sizeuintSet this property to allocate storage for the array
  minAllocSizeuintMinimum number of elements for which storage is allocated in the array

Usage


The array object can be indexed with the [ ] operator.

Elements of the array individually allocated on the heap are not freed unless Free() is invoked.

The array itself is must be instantiated and deleted as it is a ckass type.

Example

void test()
{
Array points { size = 10 };
points[0] = { 10, 10 };
points.size = 20;
points[19] = { 5, 5 };
delete points;
}

Remarks


The Array container class (like all containr classes) comes with some level of overhead, including an implied extra reference level and the overhead of multiple re-allocations. If dynamic reallocation is not required, stick to regular C arrays (e.g. int array[10]).

See Also


Container