libsc
1.6.0
|
The sc_array object provides a large array of equal-size elements. More...
#include <sc_containers.h>
Data Fields | |
size_t | elem_size |
size of a single element | |
size_t | elem_count |
number of valid elements | |
ssize_t | byte_alloc |
number of allocated bytes or -(number of viewed bytes + 1) if this is a view: the "+ 1" distinguishes an array of size 0 from a view of size 0 | |
char * | array |
linear array to store elements |
The sc_array object provides a large array of equal-size elements.
The array can be resized. Elements are accessed by their 0-based index, their address may change. The size (== elem_count) of the array can be changed by array_resize. Elements can be sorted with array_sort. If the array is sorted elements can be binary searched with array_bsearch. A priority queue is implemented with pqueue_add and pqueue_pop. Use sort and search whenever possible, they are faster than the pqueue.