50#ifndef _ACF_UTILS_VECTOR_H_
51#define _ACF_UTILS_VECTOR_H_
56#include "vector_impl.h"
255 int (*sort_func)(
const void *a,
const void *b));
270 int (*sort_func)(
const void *a,
const void *b,
void *userinfo),
An optional type for wrapping a uint64_t value.
void vector_move_all(vector_t REQ_PTR(src), vector_t REQ_PTR(dest))
Moves all elements from the src vector to the dest vector.
size_t vector_len(const vector_t REQ_PTR(v))
Returns the current number of elements contained inside the vector.
void vector_create(vector_t REQ_PTR(v))
Initializes a new vector_t to a blank state, with zero starting capacity.
void * vector_remove_tail(vector_t REQ_PTR(v))
Removes and returns the last element in a vector, if any.
void * vector_remove(vector_t REQ_PTR(v), size_t index)
Removes an element from the vector at a given index.
void vector_sort(vector_t REQ_PTR(v), int(*sort_func)(const void *a, const void *b))
Sorts a vector using the and a sorting predicate.
void * vector_replace(vector_t REQ_PTR(v), void *new_elem, size_t index)
Replaces an element in the vector in-place.
void vector_insert(vector_t REQ_PTR(v), void *elem, size_t index)
Inserts a new element into the vector at a given index.
size_t vector_shrink(vector_t REQ_PTR(v))
Orders the vector to shrink to the nearest power-of-2 capacity suitable to hold its current contents.
void vector_insert_tail(vector_t REQ_PTR(v), void *elem)
Inserts a new element at the tail of the vector.
void * vector_tail(const vector_t REQ_PTR(v))
Retrieves the element at the tail of the vector, if any.
void * vector_remove_head(vector_t REQ_PTR(v))
Removes and returns the first element in a vector, if any.
void vector_sort_r(vector_t REQ_PTR(v), int(*sort_func)(const void *a, const void *b, void *userinfo), void *userinfo)
Sorts a vector using the and a thread-safe sorting predicate.
void * vector_get(const vector_t REQ_PTR(v), size_t index)
Retrieves elements within the vector.
opt_size_t vector_find(const vector_t REQ_PTR(v), const void *item)
Locates an element in the vector by value.
void vector_create_cap(vector_t REQ_PTR(v), size_t cap_hint)
Initializes a new vector_t with a capacity hint.
void * vector_head(const vector_t REQ_PTR(v))
Retrieves the element at the head of the vector, if any.
size_t vector_cap(const vector_t REQ_PTR(v))
Returns the current element capacity of the vector.
void vector_destroy(vector_t REQ_PTR(v))
Destroys a vector previously created using vector_create().