ListContains
ListContains
Description
Check whether list contains a matching item.
Parameters
| Name | Direction | Description |
|---|---|---|
l |
in | List to search. |
item_ptr |
in | Pointer to searched value. |
compare |
in | Comparator returning 0 for equality. |
Success
true when a matching item exists.
Failure
false
Usage example (Cross-references)
Usage examples (Cross-references)
- In
List.Access.c:37:
static bool test_list_find_contains(void) {
WriteFmt("Testing ListFind and ListContains\n");
typedef List(int) IntList;- In
List.Access.c:45:
int missing = 99;
bool result = (ListFind(&list, &needle, compare_ints) == SIZE_MAX);
result = result && !ListContains(&list, &needle, compare_ints);
ListPushBackR(&list, 10);- In
List.Access.c:53:
result = result && (ListFind(&list, &needle, compare_ints) == 1);
result = result && ListContains(&list, &needle, compare_ints);
result = result && !ListContains(&list, &missing, compare_ints);
result = result && (ListFind(&list, &missing, compare_ints) == SIZE_MAX);- In
List.Access.c:54:
result = result && (ListFind(&list, &needle, compare_ints) == 1);
result = result && ListContains(&list, &needle, compare_ints);
result = result && !ListContains(&list, &missing, compare_ints);
result = result && (ListFind(&list, &missing, compare_ints) == SIZE_MAX);
Last updated on