Node structure representing an element in the vector.
Definition vector.h:10
void * data
Definition vector.h:11
struct VectorNode * next
Definition vector.h:12
Structure representing a generic linked-list-backed Vector.
Definition vector.h:18
size_t element_size
Definition vector.h:20
size_t size
Definition vector.h:21
VectorNode * head
Definition vector.h:19
void vector_destroy(Vector *vector)
Destroys the Vector and frees all allocated nodes and their associated data.
Definition vector.c:39
bool vector_update(Vector *vector, size_t index, const void *new_data)
Updates the element data at a specific index in the vector.
Definition vector.c:109
int vector_search(Vector *vector, int(*cmp_fn)(void *, void *), void *key)
Searches for an element in the vector using a custom comparison function.
Definition vector.c:142
bool vector_remove(Vector *vector, size_t index)
Removes an element at a specific index from the vector.
Definition vector.c:78
void * vector_get(Vector *vector, size_t index)
Retrieves a pointer to the element at a specific index.
Definition vector.c:128
int vector_size(const Vector *vector)
Retrieves the total number of elements currently stored in the vector.
Definition vector.c:162
bool vector_insert(Vector *vector, const void *data)
Appends (inserts) a new element to the end of the vector.
Definition vector.c:61
bool vector_sort(Vector *vector, int(*cmp_fn)(void *, void *))
Sorts the elements in the vector using a comparison function.
Definition vector.c:170
void vector_init(Vector *vector, size_t element_size)
Initializes an empty Vector.
Definition vector.c:29