aboutsummaryrefslogtreecommitdiff
path: root/collections/vector/vector.h
blob: 4d6d04cd2438ca3d1d0fcc4e76da3ef54427dd48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef VECTOR_H
#define VECTOR_H

typedef struct vector vec;

/*constructors*/
vec* vec_new();
vec* vec_with_capacity(int);

/*management*/
int vec_size(vec*);
int vec_capacity(vec*);
vec* vec_cp(vec*);
void vec_print(vec*, char* (void*));

/*data*/
void vec_push(vec*, void*);
void* vec_pop(vec*);
void* vec_back(vec*);

void vec_set(vec*, int, void*);
void* vec_index(vec*, int);

void vec_insert(vec*, int, void*);
void* vec_remove(vec*, int);

void vec_swap(vec*, int, int);
void* vec_swap_pop(vec*, int);


/*memory*/
void vec_truncate(vec*, int);
void vec_reserve(vec*, int);

void vec_clear(vec*);
void vec_free(vec*);
#endif