Cthulhu
0.2.10
Cthulhu compiler collection
|
Generic vector. More...
Functions | |
CT_STD_API void | vector_delete (STA_RELEASE vector_t *vector) |
destroy a vector More... | |
CT_NODISCARD CT_STD_API vector_t * | vector_new (size_t size, arena_t *arena) |
create a new vector with an initial capacity More... | |
CT_NODISCARD CT_STD_API vector_t * | vector_of (size_t len, arena_t *arena) |
create a new vector with a specified length More... | |
CT_NODISCARD CT_STD_API vector_t * | vector_init (void *value, arena_t *arena) |
create a new vector with a single initial value More... | |
CT_NODISCARD CT_STD_API vector_t * | vector_clone (vector_t *vector) |
clone a vector More... | |
CT_STD_API void | vector_push (vector_t **vector, void *value) |
push a value onto the end of a vector More... | |
CT_STD_API void | vector_drop (vector_t *vector) |
pop a value from the end of a vector More... | |
CT_STD_API void | vector_set (vector_t *vector, size_t index, void *value) |
set a value in a vector More... | |
CT_NODISCARD CT_PUREFN CT_STD_API void * | vector_get (const vector_t *vector, size_t index) |
get a value from a vector More... | |
CT_NODISCARD CT_PUREFN CT_STD_API void * | vector_tail (const vector_t *vector) |
get the last element of a vector More... | |
CT_NODISCARD CT_PUREFN CT_STD_API size_t | vector_len (const vector_t *vector) |
get the length of a vector More... | |
CT_STD_API void | vector_append (vector_t **vector, const vector_t *other) |
append the contents of one vector to another this copies the contents of other into vector More... | |
CT_PUREFN CT_STD_API size_t | vector_find (vector_t *vector, const void *element) |
find an element in a vector searches via pointer equality More... | |
CT_STD_API void | vector_reset (vector_t *vec) |
reset the contents of a vector More... | |
CT_STD_API void ** | vector_data (vector_t *vec) |
get the data of a vector More... | |
Variables | |
CT_STD_API vector_t | gEmptyVector |
a global empty vector used to avoid allocating alot of empty vectors More... | |
CT_STD_API const vector_t | kEmptyVector |
a global empty vector used to avoid allocating alot of empty vectors More... | |
Generic vector.
CT_NODISCARD CT_STD_API vector_t* vector_clone | ( | vector_t * | vector | ) |
CT_STD_API void** vector_data | ( | vector_t * | vec | ) |
CT_STD_API void vector_delete | ( | STA_RELEASE vector_t * | vector | ) |
destroy a vector
vector | the vector to destroy |
CT_STD_API void vector_drop | ( | vector_t * | vector | ) |
CT_NODISCARD CT_PUREFN CT_STD_API void* vector_get | ( | const vector_t * | vector, |
size_t | index | ||
) |
CT_NODISCARD CT_STD_API vector_t* vector_init | ( | void * | value, |
arena_t * | arena | ||
) |
create a new vector with a single initial value
this is equivalent to
value | the initial value of the vector |
arena | the arena to allocate from |
CT_NODISCARD CT_PUREFN CT_STD_API size_t vector_len | ( | const vector_t * | vector | ) |
CT_NODISCARD CT_STD_API vector_t* vector_new | ( | size_t | size, |
arena_t * | arena | ||
) |
CT_NODISCARD CT_STD_API vector_t* vector_of | ( | size_t | len, |
arena_t * | arena | ||
) |
create a new vector with a specified length
len | the initial size of the vector |
arena | the arena to allocate from |
CT_STD_API void vector_push | ( | vector_t ** | vector, |
void * | value | ||
) |
CT_STD_API void vector_reset | ( | vector_t * | vec | ) |
CT_STD_API void vector_set | ( | vector_t * | vector, |
size_t | index, | ||
void * | value | ||
) |
CT_NODISCARD CT_PUREFN CT_STD_API void* vector_tail | ( | const vector_t * | vector | ) |
|
extern |