26 lines
521 B
C
26 lines
521 B
C
#pragma once
|
|
|
|
#include <stddef.h>
|
|
|
|
typedef struct treeset treeset_t;
|
|
typedef struct treeset_node treeset_node_t;
|
|
|
|
/*
|
|
* Cast a and b to your custom struct and return:
|
|
* 1 for greater than
|
|
* -1 for less than
|
|
* 0 for equal
|
|
*/
|
|
int treeset_demo_cmp(void *a, void *b) {
|
|
if (*((int *)a) > *((int *)a))
|
|
return -1;
|
|
if (*((int *)a) < *((int *)a))
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
void treeset_destroy(treeset_t *set);
|
|
void put(treeset_t *set, void *data, int (*cmp)(void *, void *));
|
|
// contains
|
|
// remove
|