Module: collections.growable

Source: ./collections/growable.reef


Overview

collections/growable - Growable arrays for common types

Provides dynamic array types that automatically grow when capacity is exceeded. These are separate from List[T] to avoid modifying the core list module.

Usage: let arr = new_int_array() ga_append_int(arr, 42) // Auto-grows if needed


Types

IntArray

Fields:

Name Type
items [int]
len int
cap int

StringArray

Fields:

Name Type
items [string]
len int
cap int

PtrArray

Fields:

Name Type
items [pointer]
len int
cap int

Functions

fn new_int_array(): IntArray

fn new_string_array(): StringArray

fn new_int_array_cap(cap: int): IntArray

fn new_string_array_cap(cap: int): StringArray

fn new_ptr_array(): PtrArray

fn new_ptr_array_cap(cap: int): PtrArray

fn ga_length_int(arr: IntArray): int

fn ga_capacity_int(arr: IntArray): int

fn ga_get_int(arr: IntArray, index: int): option.Option[int]

fn ga_set_int(arr: IntArray, index: int, item: int): bool

fn ga_append_int(arr: IntArray, item: int): bool

fn ga_length_string(arr: StringArray): int

fn ga_capacity_string(arr: StringArray): int

fn ga_get_string(arr: StringArray, index: int): option.Option[string]

fn ga_set_string(arr: StringArray, index: int, item: string): bool

fn ga_append_string(arr: StringArray, item: string): bool

fn ga_length_ptr(arr: PtrArray): int

fn ga_capacity_ptr(arr: PtrArray): int

fn ga_get_ptr(arr: PtrArray, index: int): option.Option[pointer]

fn ga_set_ptr(arr: PtrArray, index: int, item: pointer): bool

fn ga_append_ptr(arr: PtrArray, item: pointer): bool


Procedures

proc ga_grow_int(arr: IntArray)

proc ga_grow_string(arr: StringArray)

proc ga_grow_ptr(arr: PtrArray)


Generated by reefc doc