5 * heap - a simple heap implementation
7 * Each heap entry is added as a void pointer. This means the implementation
8 * does _not_ assume you already have an array of entries. Instead, it keeps
9 * an internal array of pointers to those entries.
14 * #include <ccan/heap/heap.h>
16 * static bool less(const int *i, const int *j)
21 * static bool __less(const void *i, const void *j)
26 * int main(int argc, char *argv[])
29 * int arr[] = {1, 0, 2};
32 * h = heap_init(__less);
34 * perror("heap alloc");
38 * for (i = 0; i < 3; i++) {
39 * if (heap_push(h, &arr[i])) {
40 * perror("heap push");
44 * // should print 0, 1, 2
45 * for (i = 0; i < 3; i++) {
46 * int *v = heap_pop(h);
54 * Author: Emilio G. Cota <cota@braap.org>
56 int main(int argc, char *argv[])
58 /* Expect exactly one argument */
62 if (strcmp(argv[1], "depends") == 0) {