--- a/docs/Writerside/topics/collection.h.md Sun Dec 14 16:21:09 2025 +0100 +++ b/docs/Writerside/topics/collection.h.md Sun Dec 14 17:30:17 2025 +0100 @@ -44,15 +44,23 @@ In each case the argument `c` is a pointer to your collection. The macro will then access the base data with `c->collection`. -Similar to the above macros, the `cxCollectionCompareFunc(c,f)` macro can be used to set the compare function. +On the other hand, the following macros can be used to set the properties of a collection: + +```C +cxSetCompareFunc(c, func) +cxSetDestructor(c, destr) +cxSetAdvancedDestructor(c, destr, data) +``` + +More details on the destructor functions follow in the next section. ## Destructor Functions For working with destructors, the following macros are defined: ```C -cxDefineDestructor(c, destr) -cxDefineAdvancedDestructor(c, destr, data) +cxSetDestructor(c, destr) +cxSetAdvancedDestructor(c, destr, data) // use in your collection's implementation cx_invoke_destructor(c, elem) @@ -62,9 +70,9 @@ cx_invoke_advanced_destructor(c, elem) ``` -With `cxDefineDestructor()` you can assign a simple [destructor function](allocator.h.md#destructor-functions) +With `cxSetDestructor()` you can assign a simple [destructor function](allocator.h.md#destructor-functions) to an _instance_ of your collection. -Similarly, you can assign an advanced destructor with custom `data` by using `cxDefineAdvancedDestructor`. +Similarly, you can assign an advanced destructor with custom `data` by using `cxSetAdvancedDestructor`. Your collection _should_ be supporting destructors by invoking `cx_invoke_destructor()` whenever an element is removed from your collection _without_ being returned to the caller.