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