diff -r 309e8b08c60e -r 55cc3b373c5e src/list.c --- a/src/list.c Mon Jan 23 20:34:18 2023 +0100 +++ b/src/list.c Wed Jan 25 19:19:29 2023 +0100 @@ -28,6 +28,8 @@ #include "cx/list.h" +#include + void cxListDestroy(CxList *list) { switch (list->content_destructor_type) { case CX_DESTRUCTOR_SIMPLE: { @@ -80,3 +82,16 @@ } } } + +CxMutIterator cxListMutIterator( + CxList *list, + size_t index +) { + CxIterator it = list->cl->iterator(list, index); + it.base.mutating = true; + + // we know the iterators share the same memory layout + CxMutIterator iter; + memcpy(&iter, &it, sizeof(CxMutIterator)); + return iter; +}