A simple hashset with owned keys. It handles conflicts through linear probing and has static size.
set_t* set = setCreate(10);
setAdd(set, "key"); // returns result
setHas(set, "key"); // returns true
setHas(set, "another key"); // returns false
setDelete(set, "key");
setDestroy(&set);
Create a new set with the specified size.
set_t* set = setCreate(10);
Add a key to the set. The key is copied and owned by the set.
setAdd(set, "key");
Check if a key exists in the set.
if (setHas(set, "key")) {
// key exists
}
Delete a key from the set.
setDelete(set, "key");
Get the number of keys currently stored in the set.
set_size_t count = setUsed(set);
Destroy the set and free all allocated memory.
setDestroy(&set);