CBuild wiki
Implements dynamic array datatype. It works over structures with
specific “form”, where T is a generic type:
License: GPL-3.0-or-later. Create type for a new dynamic
array.
type type Type of elements for a new dynamic
array.Append new element to dynamic array.
cbuild_da_t*
da Dynamic array object.*typeof(da->data)
elem Element to append.Append new elements to dynamic array.
cbuild_da_t*
da Dynamic array object.typeof(da->data)
arr Elements to append.size_t arr_size Number of elements to append.Append new elements to dynamic array.
cbuild_da_t*
da Dynamic array object.*typeof(da->data)
… Elements to append.Pop element from top of a dynamic array.
cbuild_da_t*
da Dynamic array object.*typeof(da->data)
Popped element.
Remove element dynamic array using its index.
cbuild_da_t*
da Dynamic array object.size_t idx Element index.bool False on
overflow.
Remove element dynamic array using its index.
This function has O(1) complexity but changes ordering of elements in an array. It copies last element into same index as removed one, overriding it and then just decrease size by 1.
cbuild_da_t*
da Dynamic array object.size_t idx Element index.bool False on
overflow.
Resize dynamic array.
cbuild_da_t*
da Dynamic array object.size_t new_size Resize dynamic array. If new_size
equal 0 default growth strategy will be used.Free dynamic array.
This should be used only if you want to free underlying memory, if
you just want to clear array and reuse it, setting size to
0 would be much faster.
cbuild_da_t*
da Dynamic array object.