Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*_contains function for values #18

Closed
srdja opened this issue Mar 26, 2016 · 1 comment
Closed

*_contains function for values #18

srdja opened this issue Mar 26, 2016 · 1 comment

Comments

@srdja
Copy link
Owner

srdja commented Mar 26, 2016

Collections should also have a *_contains function that looks for values instead of pointers.

bool equals(void *e1, void *e2) {
    int el1 = *((int*)e1);
    itn el2 = *((int*)e2);
    if (el1 == el2) return true;
    return false;
}

...

int a = 10;
size_t count = array_contains(array, &a, equals);
@srdja
Copy link
Owner Author

srdja commented Apr 11, 2016

done

@srdja srdja closed this as completed Apr 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant