7 #define CVEC_SIZE_T size_t
cvector_d * cvec_d_heap(cvec_sz size, cvec_sz capacity)
Creates a new cvector_d on the heap.
int cvec_insert_array_d(cvector_d *vec, cvec_sz i, double *a, cvec_sz num)
Insert the first num elements of array a at index i.
int cvec_insert_d(cvector_d *vec, cvec_sz i, double a)
Insert a at index i (0 based).
void cvec_free_d(void *vec)
Frees the internal array and sets size and capacity to 0.
void cvec_erase_d(cvector_d *vec, cvec_sz start, cvec_sz end)
Erases elements from start to end inclusive.
cvector_d * cvec_init_d_heap(double *vals, cvec_sz num)
Create (on the heap) and initialize cvector_d with num elements of vals.
void cvec_set_val_cap_d(cvector_d *vec, double val)
Fills entire allocated array (capacity) with val.
int cvec_copy_d(cvector_d *dest, cvector_d *src)
Makes dest a copy of src.
int cvec_reserve_d(cvector_d *vec, cvec_sz size)
Make sure capacity is at least size(parameter not member).
int cvec_extend_d(cvector_d *vec, cvec_sz num)
Increase the size of the array num items.
int cvec_copyc_d(void *dest, void *src)
Makes dest a copy of src.
double cvec_replace_d(cvector_d *vec, cvec_sz i, double a)
Replace value at index i with a, return original value.
void cvec_set_val_sz_d(cvector_d *vec, double val)
Set all size elements to val.
int cvec_d(cvector_d *vec, cvec_sz size, cvec_sz capacity)
Same as cvec_d_heap() except the vector passed in was declared on the stack so it isn't allocated in ...
int cvec_set_cap_d(cvector_d *vec, cvec_sz size)
Set capacity to size.
double * cvec_back_d(cvector_d *vec)
Return pointer to last element.
int cvec_push_d(cvector_d *vec, double a)
Append a to end of vector (size increased 1).
void cvec_clear_d(cvector_d *vec)
Sets size to 0 (does not clear contents).
void cvec_free_d_heap(void *vec)
Frees everything so don't use vec after calling this.
int cvec_init_d(cvector_d *vec, double *vals, cvec_sz num)
Same as cvec_init_d_heap() except the vector passed in was declared on the stack so it isn't allocate...
double cvec_pop_d(cvector_d *vec)
Remove and return the last element (size decreased 1).
Data structure for double vector.
cvec_sz size
Current size (amount you use when manipulating array directly).
cvec_sz capacity
Allocated size of array; always >= size.