858 * |
858 * |
859 * @param list the list |
859 * @param list the list |
860 * @param elem the element to find |
860 * @param elem the element to find |
861 * @return the index of the element or the size of the list when the element is not found |
861 * @return the index of the element or the size of the list when the element is not found |
862 * @see cxListIndexValid() |
862 * @see cxListIndexValid() |
|
863 * @see cxListContains() |
863 */ |
864 */ |
864 cx_attr_nonnull |
865 cx_attr_nonnull |
865 cx_attr_nodiscard |
866 cx_attr_nodiscard |
866 static inline size_t cxListFind( |
867 static inline size_t cxListFind( |
867 const CxList *list, |
868 const CxList *list, |
868 const void *elem |
869 const void *elem |
869 ) { |
870 ) { |
870 return list->cl->find_remove((CxList*)list, elem, false); |
871 return list->cl->find_remove((CxList*)list, elem, false); |
|
872 } |
|
873 |
|
874 /** |
|
875 * Checks, if the list contains the specified element. |
|
876 * |
|
877 * The elements are compared with the list's comparator function. |
|
878 * |
|
879 * @param list the list |
|
880 * @param elem the element to find |
|
881 * @retval true if the element is contained |
|
882 * @retval false if the element is not contained |
|
883 * @see cxListFind() |
|
884 */ |
|
885 cx_attr_nonnull |
|
886 cx_attr_nodiscard |
|
887 static inline bool cxListContains( |
|
888 const CxList* list, |
|
889 const void* elem |
|
890 ) { |
|
891 return list->cl->find_remove((CxList*)list, elem, false) < list->collection.size; |
871 } |
892 } |
872 |
893 |
873 /** |
894 /** |
874 * Checks if the specified index is within bounds. |
895 * Checks if the specified index is within bounds. |
875 * |
896 * |