2016-12-20 00:32:34 -08:00
|
|
|
#ifndef LIBDS_VEC_HEADER
|
|
|
|
#define LIBDS_VEC_HEADER
|
|
|
|
|
|
|
|
#define LIBDS_VEC_CAPACITY 4
|
|
|
|
|
|
|
|
#include "libds.h"
|
|
|
|
|
|
|
|
struct vec_s {
|
|
|
|
void* data;
|
|
|
|
int capacity;
|
|
|
|
int size;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct vec_s vec;
|
|
|
|
|
|
|
|
libds_result vec_init(vec*);
|
|
|
|
void vec_free(vec*);
|
|
|
|
|
|
|
|
libds_result vec_add(vec*, void*);
|
|
|
|
void vec_remove(vec*, void*);
|
|
|
|
|
|
|
|
void* vec_find(vec*, void*, compare_func);
|
|
|
|
int vec_foreach(vec*, void*, compare_func, foreach_func, ...);
|
|
|
|
|
2016-12-20 23:28:07 -08:00
|
|
|
void* vec_index(vec*, int);
|
|
|
|
|
2016-12-20 00:32:34 -08:00
|
|
|
#endif
|