-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_array_macros.h
More file actions
34 lines (24 loc) · 957 Bytes
/
_array_macros.h
File metadata and controls
34 lines (24 loc) · 957 Bytes
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
#define dynamic_array(type) dynamic_array_##type
#define DEFINE_DYNAMIC_ARRAY(type)\
struct dynamic_array_##type \
{ \
type* data; \
size_t capacity; \
size_t size; \
}
#define DEFINE_ARRAY_CTOR(type) \
void array_ctor(dynamic_array(type)* array)
#define DEFINE_ARRAY_DTOR(type) \
void array_dtor(dynamic_array(type)* array)
#define DEFINE_ARRAY_PUSH(type) \
void array_push(dynamic_array(type)* array, type element)
#define DEFINE_ARRAY_POP(type) \
void array_pop(dynamic_array(type)* array)
#define DEFINE_ARRAY_COPY(type) \
void array_copy(dynamic_array(type)* dest, const dynamic_array(type)* src)
#define DEFINE_ARRAY_GET(type) \
type* array_get_element(const dynamic_array(type)* array, size_t index)
#define DEFINE_ARRAY_FRONT(type) \
type* array_front(const dynamic_array(type)* array)
#define DEFINE_ARRAY_BACK(type) \
type* array_back(const dynamic_array(type)* array)