166 |
166 |
167 size_t cxListFind(const CxList *list, const void *elem); |
167 size_t cxListFind(const CxList *list, const void *elem); |
168 |
168 |
169 size_t cxListFindRemove(CxList *list, const void *elem); |
169 size_t cxListFindRemove(CxList *list, const void *elem); |
170 |
170 |
|
171 bool cxListContains(const CxList *list, const void *elem); |
|
172 |
171 bool cxListIndexValid(const CxList *list, size_t index); |
173 bool cxListIndexValid(const CxList *list, size_t index); |
172 |
174 |
173 size_t cxListSize(const CxList *list); |
175 size_t cxListSize(const CxList *list); |
174 ``` |
176 ``` |
175 |
177 |
188 and returns the first index when the element was found. |
190 and returns the first index when the element was found. |
189 Otherwise, the function returns the list size. |
191 Otherwise, the function returns the list size. |
190 |
192 |
191 The function `cxListFindRemove()` behaves like `cxListFind()`, except that it also removes the first occurrence of the element from the list. |
193 The function `cxListFindRemove()` behaves like `cxListFind()`, except that it also removes the first occurrence of the element from the list. |
192 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. |
194 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. |
|
195 |
|
196 The function `cxListContains()` returns `true`, if and only if `cxListFind()` would return a valid index. |
193 |
197 |
194 With `cxListIndexValid()` you can check the index returned by `cxListFind()` or `cxListFindRemove()`, |
198 With `cxListIndexValid()` you can check the index returned by `cxListFind()` or `cxListFindRemove()`, |
195 which is more convenient than comparing the return value if the return value of `cxListSize()`. |
199 which is more convenient than comparing the return value if the return value of `cxListSize()`. |
196 |
200 |
197 ## Remove |
201 ## Remove |