added List_T_destroyWithElements
This commit is contained in:
@@ -39,6 +39,13 @@ static inline List(T) List_##T##_copy(const List(T)* src) { \
|
|||||||
\
|
\
|
||||||
static inline void List_##T##_destroy(List(T)* self) { _List_destroy((void*)self); } \
|
static inline void List_##T##_destroy(List(T)* self) { _List_destroy((void*)self); } \
|
||||||
\
|
\
|
||||||
|
static inline void List_##T##_destroyWithElements(List(T)* self, void (*elem_destructor)(T*)) { \
|
||||||
|
for(u32 i = 0; i < self->len; i++){ \
|
||||||
|
elem_destructor(self->data + i);\
|
||||||
|
} \
|
||||||
|
_List_destroy((void*)self); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
/* alloc bigger buffer if size + len_to_add won't fit in current */ \
|
/* alloc bigger buffer if size + len_to_add won't fit in current */ \
|
||||||
static inline void List_##T##_increaseCapacity(List(T)* self, u32 len_to_add){ \
|
static inline void List_##T##_increaseCapacity(List(T)* self, u32 len_to_add){ \
|
||||||
_List_increaseCapacity((void*)self, len_to_add); \
|
_List_increaseCapacity((void*)self, len_to_add); \
|
||||||
|
|||||||
Reference in New Issue
Block a user