1#ifndef INCLUDE_VECTOR_VECTOR_H_
2#define INCLUDE_VECTOR_VECTOR_H_
8# define CARRVECTOR_OPEN extern "C" {
9# define CARRVECTOR_CLOSE }
11# define CARRVECTOR_OPEN
12# define CARRVECTOR_CLOSE
26#ifndef CARR_VECTOR_CAP_ADDITION
27# define CARR_VECTOR_CAP_ADDITION 16
CARRError carr_deleteIndex(CARR *vec, const size_t index, const bool fall)
Deletes an element at a specified index.
CARRError carr_resize(CARR *vec, const size_t newCap)
Changes the capacity of a vector.
void carr_destroy(CARR *vec)
Destroys a vector and releases its internal resources.
CARR carr_init(const size_t cap, const bool dynamic)
Initializes a new CARR vector.
CARRError
Error codes returned by CARR operations.
@ CARR_VEC_ResizeError
The requested resize operation could not be completed.
@ CARR_VEC_OutOfBounds
The requested index is outside the valid range.
@ CARR_VEC_NULL
A required pointer argument was NULL.
@ CARR_VEC_OOM
Memory allocation failed.
@ CARR_VEC_OK
The operation completed successfully.
CARRError carr_pushFront(CARR *vec, void *item)
Inserts an element at the beginning of the vector.
CARRError carr_reverse(CARR *vec)
Reverses the order of elements in the vector.
CARRError carr_pushBack(CARR *vec, void *item)
Appends an element to the end of the vector.
CARRError carr_replaceIndex(CARR *vec, void *item, const size_t idx)
Replaces an element at a specified index.
Represents a pointer-based vector container.
bool __initialized
Internal initialization-state flag.
size_t cap
Maximum number of elements that can be stored without resizing.
size_t size
Number of elements currently stored in the vector.
bool dynamic
Indicates whether the vector supports dynamic resizing.
void ** vec
Pointer to the array of stored element pointers.