7 #define CVEC_SIZE_T size_t
int cvec_insert_i(cvector_i *vec, cvec_sz i, int a)
Insert a at index i (0 based).
void cvec_free_i_heap(void *vec)
Frees everything so don't use vec after calling this.
void cvec_free_i(void *vec)
Frees the internal array and sets size and capacity to 0.
int cvec_pop_i(cvector_i *vec)
Remove and return the last element (size decreased 1).
int cvec_copyc_i(void *dest, void *src)
Makes dest a copy of src.
int cvec_replace_i(cvector_i *vec, cvec_sz i, int a)
Replace value at index i with a, return original value.
int cvec_insert_array_i(cvector_i *vec, cvec_sz i, int *a, cvec_sz num)
Insert the first num elements of array a at index i.
cvector_i * cvec_init_i_heap(int *vals, cvec_sz num)
Create (on the heap) and initialize cvector_i with num elements of vals.
int cvec_copy_i(cvector_i *dest, cvector_i *src)
Makes dest a copy of src.
int cvec_set_cap_i(cvector_i *vec, cvec_sz size)
Set capacity to size.
int cvec_reserve_i(cvector_i *vec, cvec_sz size)
Make sure capacity is at least size(parameter not member).
int cvec_push_i(cvector_i *vec, int a)
Append a to end of vector (size increased 1).
void cvec_erase_i(cvector_i *vec, cvec_sz start, cvec_sz end)
Erases elements from start to end inclusive.
int cvec_init_i(cvector_i *vec, int *vals, cvec_sz num)
Same as cvec_init_i_heap() except the vector passed in was declared on the stack so it isn't allocate...
int cvec_i(cvector_i *vec, cvec_sz size, cvec_sz capacity)
Same as cvec_i_heap() except the vector passed in was declared on the stack so it isn't allocated in ...
cvector_i * cvec_i_heap(cvec_sz size, cvec_sz capacity)
Creates a new cvector_i on the heap.
int * cvec_back_i(cvector_i *vec)
Return pointer to last element.
void cvec_clear_i(cvector_i *vec)
Sets size to 0 (does not clear contents).
int cvec_extend_i(cvector_i *vec, cvec_sz num)
Increase the size of the array num items.
void cvec_set_val_cap_i(cvector_i *vec, int val)
Fills entire allocated array (capacity) with val.
void cvec_set_val_sz_i(cvector_i *vec, int val)
Set all size elements to val.
Data structure for int vector.
cvec_sz size
Current size (amount you use when manipulating array directly).
cvec_sz capacity
Allocated size of array; always >= size.