5 * objset - unordered set of pointers.
7 * This code implements a very simple unordered set of pointers. It's very
8 * fast to add and check if something is in the set; it's implemented by
11 * License: LGPL (v2.1 or any later version)
14 * // Silly example to determine if an arg starts with a -
15 * #include <ccan/objset/objset.h>
19 * OBJSET_MEMBERS(const char *);
22 * int main(int argc, char *argv[])
24 * struct objset_arg args;
28 * // Put all args starting with - in the set.
29 * for (i = 1; i < argc; i++)
30 * if (argv[i][0] == '-')
31 * objset_add(&args, argv[i]);
33 * if (objset_empty(&args))
34 * printf("No arguments start with -.\n");
36 * for (i = 1; i < argc; i++)
37 * if (objset_get(&args, argv[i]))
43 * // Given 'a b c' outputs No arguments start with -.
44 * // Given 'a -b c' outputs 2,
45 * // Given 'a -b -c d' outputs 2,3,
47 int main(int argc, char *argv[])
49 /* Expect exactly one argument */
53 if (strcmp(argv[1], "depends") == 0) {
54 printf("ccan/hash\n");
55 printf("ccan/htable\n");
56 printf("ccan/tcon\n");