added List_T_destroyWithElements

This commit is contained in:
2025-12-21 20:22:35 +05:00
parent 26de01c3e7
commit de88e9ff16

View File

@@ -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); \