--- a/docs/Writerside/topics/list.h.md Sun Apr 13 18:01:29 2025 +0200 +++ b/docs/Writerside/topics/list.h.md Mon Apr 14 19:36:43 2025 +0200 @@ -168,6 +168,8 @@ size_t cxListFindRemove(CxList *list, const void *elem); +bool cxListContains(const CxList *list, const void *elem); + bool cxListIndexValid(const CxList *list, size_t index); size_t cxListSize(const CxList *list); @@ -191,6 +193,8 @@ The function `cxListFindRemove()` behaves like `cxListFind()`, except that it also removes the first occurrence of the element from the list. This will _also_ call destructor functions, if specified, so take special care when you continue to use `elem`, or when the list is storing pointers and the element appears more than once in the list. +The function `cxListContains()` returns `true`, if and only if `cxListFind()` would return a valid index. + With `cxListIndexValid()` you can check the index returned by `cxListFind()` or `cxListFindRemove()`, which is more convenient than comparing the return value if the return value of `cxListSize()`.