Array#

struct nvArray#

Type-generic dynamically growing array implementation.

Public Members

size_t size#

Length of the array.

size_t max#

Maximum size the array ever reached, this is basically the size of the array on HEAP.

void **data#

Array of void pointers.

Methods#

nvArray *nvArray_new()#

Create new array.

Returns:

nvArray *

void nvArray_free(nvArray *array)#

Free array.

Parameters:

array – Array to free

Warning

doxygenfunction: Unable to resolve function “nvArray_free_each” with arguments “None”. Candidate function could not be parsed. Parsing error is Error when parsing function declaration. If the function has no return type: Error in declarator or parameters-and-qualifiers Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 4] void nvArray_free_each (nvArray *array, void(free_func)(void *)) —-^ If the function has a return type: Error in declarator or parameters-and-qualifiers If pointer to member declarator: Invalid C++ declaration: Expected ‘::’ in pointer to member (function). [error at 23] void nvArray_free_each (nvArray *array, void(free_func)(void *)) ———————–^ If declarator-id: Invalid C++ declaration: Expecting “,” or “)” in parameters-and-qualifiers, got “(”. [error at 55] void nvArray_free_each (nvArray *array, void(free_func)(void *)) ——————————————————-^

void nvArray_add(nvArray *array, void *elem)#

Add new element to array.

Parameters:
  • array – Array to append to

  • elem – Void pointer to element

void *nvArray_pop(nvArray *array, size_t index)#

Remove element by index from array and return the element. Returns NULL if failed.

Note

The array is not sorted after removal, meaning the array gets slightly randomized every remove call.

Parameters:
  • array – Array

  • index – Index of element to remove

Returns:

void *

size_t nvArray_remove(nvArray *array, void *elem)#

Remove element from array and return the index. Returns -1 if failed.

Note

The array is not sorted after removal, meaning the array gets slightly randomized every remove call.

Parameters:
  • array – Array

  • elem – Element to remove

Returns:

size_t