6 * heap - a simple heap implementation
8 * Each heap entry is added as a void pointer. This means the implementation
9 * does _not_ assume you already have an array of entries. Instead, it keeps
10 * an internal array of pointers to those entries.
15 * #include <ccan/heap/heap.h>
17 * static bool less(const int *i, const int *j)
22 * static bool __less(const void *i, const void *j)
27 * int main(int argc, char *argv[])
30 * int arr[] = {1, 0, 2};
33 * h = heap_init(__less);
35 * perror("heap alloc");
39 * for (i = 0; i < 3; i++) {
40 * if (heap_push(h, &arr[i])) {
41 * perror("heap push");
45 * // should print 0, 1, 2
46 * for (i = 0; i < 3; i++) {
47 * int *v = heap_pop(h);
55 * Author: Emilio G. Cota <cota@braap.org>
57 int main(int argc, char *argv[])
59 /* Expect exactly one argument */
63 if (strcmp(argv[1], "depends") == 0) {