#include <cutk/array.h>
#include <string.h>
Defines | |
#define | aryesize(x) ((*((array_type**)(void*)(x))-1)->esize) |
Functions | |
void * | aryalloc_ (size_t esize) |
void * | aryallocsize_ (size_t esize, size_t size) |
void | aryfree (void *ary) |
int | aryreserve (void *ary, size_t max) |
int | aryresize (void *ary, size_t size) |
int | aryappend (void *ary, const void *element) |
int | aryinsert (void *ary, size_t index) |
int | aryerase (void *ary, size_t index) |
int | aryfasterase (void *ary, size_t index) |
void * | arydup (const void *ary) |
int | arycpy (void *dest, const void *src) |
int | arycat (void *dest, const void *src) |
|
|
|
Allocate a new empty array. Normally this function is not called directly. Use the aryalloc() macro instead. This allows you to specify the element type rather than the element size. Example: "int* array = aryalloc(int);"
|
|
Allocate a new array of a specified size. Normally this function is not called directly. Use the aryallocsize() macro instead. Example: "int* array = aryallocsize(int, 2000);"
|
|
This adds and copies a new element to the end of the array.
|
|
Appends the source array to the end of the destination
|
|
This copies an array. This is just a convenient way to do an aryfree() followed by arydup().
|
|
This duplicates an array. The new array will use the minimum amount of memory necessary to hold all the elements in the array.
|
|
|
|
|
|
This releases all memory held by an array.
|
|
Inserts a new element at position "index"
|
|
This preallocates memory for a certain maximum number of elements. Note that this does not change the size of the array unless max is less than the current size of the array.
|
|
This resizes an array. Note that this does not free any memory held by the array if the size is smaller than the current size.
|