Data Structures | |
struct | cucon_array |
Functions | |
void | cucon_array_init (cucon_array_t arr, cu_bool_t is_atomic, size_t size) |
cucon_array_t | cucon_array_new (cu_bool_t is_atomic, size_t size) |
void | cucon_array_swap (cucon_array_t arr0, cucon_array_t arr1) |
size_t | cucon_array_size (cucon_array_t arr) |
void * | cucon_array_ref_at (cucon_array_t arr, size_t index) |
void * | cucon_array_detach (cucon_array_t arr) |
void | cucon_array_resize_gp (cucon_array_t arr, size_t size) |
void | cucon_array_resize_gpmax (cucon_array_t arr, size_t size) |
void | cucon_array_resize_exact (cucon_array_t arr, size_t size) |
void | cucon_array_resize_exactmax (cucon_array_t arr, size_t size) |
void * | cucon_array_extend_gp (cucon_array_t arr, size_t size) |
void * | cucon_array_extend_exact (cucon_array_t arr, size_t size) |
void * | cucon_array_begin (cucon_array_t arr) |
void * | cucon_array_end (cucon_array_t arr) |
This header provides generic arrays of inlined elements. All sizes and indices are measured in bytes, and must be scaled with the element size.
void* cucon_array_begin | ( | cucon_array_t | arr | ) |
A pointer to the start of the internal array. If converted to an appropriate pointer type, it can be used as an iterator.
void* cucon_array_detach | ( | cucon_array_t | arr | ) |
Returns a plain memory fragment with the data stored in the array and invalidates arr. The memory fragment may be reallocated and copied if the capacity of arr is larger than its size.
void* cucon_array_end | ( | cucon_array_t | arr | ) |
A pointer past the end of the internal array.
void* cucon_array_extend_exact | ( | cucon_array_t | arr, | |
size_t | size | |||
) |
Extend arr with size entries, and return a pointer to the first one. The array capacity is increased to exactly match size if needed. If you are calling this many times, use cucon_array_extend_gp for better time complexity.
void* cucon_array_extend_gp | ( | cucon_array_t | arr, | |
size_t | size | |||
) |
Extend arr with size entries, and return a pointer to the first one. The array capacity is increased geometrically.
void cucon_array_init | ( | cucon_array_t | arr, | |
cu_bool_t | is_atomic, | |||
size_t | size | |||
) |
Construct an array of initially size bytes. If true is passed for is_atomic, then atomic allocation will be used for the array data.
cucon_array_t cucon_array_new | ( | cu_bool_t | is_atomic, | |
size_t | size | |||
) |
Returns an array of initially size bytes. If true is passed for is_atomic, then atomic allocation will be used for the array data.
void* cucon_array_ref_at | ( | cucon_array_t | arr, | |
size_t | index | |||
) |
Pointer to entry at index in arr.
void cucon_array_resize_exact | ( | cucon_array_t | arr, | |
size_t | size | |||
) |
Resize arr to size, changing the capacity to match the size. If you are growing an array, cucon_array_resize_gp gives better amortised time-complexity.
void cucon_array_resize_exactmax | ( | cucon_array_t | arr, | |
size_t | size | |||
) |
Resize arr to size, increasing capacity to match the size if necesary. This call never decrease the capacity. If you are growing an array, cucon_array_resize_gpmax gives better amortised time-complexity.
void cucon_array_resize_gp | ( | cucon_array_t | arr, | |
size_t | size | |||
) |
Resize arr to size, changing the capacity in geometric progression if necessary.
void cucon_array_resize_gpmax | ( | cucon_array_t | arr, | |
size_t | size | |||
) |
Resize arr to size, increasing capacity geometrically if necessary. This call never decrease the capacity.
size_t cucon_array_size | ( | cucon_array_t | arr | ) |
The size of arr.
void cucon_array_swap | ( | cucon_array_t | arr0, | |
cucon_array_t | arr1 | |||
) |
Swap the values of arr0 and arr1.