ArrayList

Macros

‘DEFINE_ARRAYLIST(TYPE)’ Define a new Arraylist.

Types

struct ArrayList
A typed, dynamically sized array, where ##TYPE is replaced by the typename, such as ‘ArrayList_float’.

Functions

ArrayList_Create( const uint32_t initial_capacity) : ArrayList
Create an array with an initial capacity. This will use the default allocator.

ArrayList_Create( const uint32_t initial_capacity, void* (* const allocate)(const uint32_t size, uint32_t* allocation_size_bytes), void (* const deallocate)(void* memory, const uint32_t size) ) : ArrayList
Create an array with an initial capacity. Using a custom allocator.


ArrayList_Exists(ArrayList array) : bool

ArrayList_Copy( const TYPE* data, uint32_t length, void* (* const allocate)(const uint32_t size, uint32_t* allocation_size_bytes), void (* const deallocate)(void* memory, const uint32_t size) ) : ArrayList
Create an array from a copy of the data.

ArrayList_Clone( const ArrayList array, void* (* const allocate)(const uint32_t size, uint32_t* allocation_size_bytes), void (* const deallocate)(void* memory, const uint32_t size) ) : ArrayList
Clone the array.


ArrayList_Count(ArrayList array) : uint32_t


ArrayList_Capacity(ArrayList array) : uint32_t


ArrayList_Clear(ArrayList array) : void


ArrayList_Destroy(ArrayList array) : void


ArrayList_ShrinkToFit(ArrayList array) : void


ArrayList_Reserve(ArrayList array, uint32_t capacity) : void


ArrayList_Get(ArrayList array, uint32_t index, TYPE* result) : bool
On success, returns true and populates the value in result.


ArrayList_Set(ArrayList array, uint32_t index, TYPE value) : bool
On success, returns true and sets the value in the array.


ArrayList_Pop(ArrayList array, TYPE* result) : bool
On success, returns true and populates the value in result.


ArrayList_Push(ArrayList array, TYPE value) : void


ArrayList_Append(ArrayList array, TYPE* values, uint32_t length) : void


ArrayList_InsertAt(ArrayList array, uint32_t index, TYPE value) : bool
On success, returns true and sets the value in the array.


ArrayList_RemoveAt(ArrayList array, uint32_t index) : bool


ArrayList_ExtractAt(ArrayList array, uint32_t index, TYPE* result) : bool


ArrayList_RawBuffer(ArrayList array, uint32_t* result_size) : const TYPE*


ArrayList_GetRef(ArrayList array, uint32_t index) : const TYPE*


ArrayList_GetMutRef(ArrayList array, uint32_t index) : TYPE*