aboutsummaryrefslogtreecommitdiff
path: root/set/set.ha
diff options
context:
space:
mode:
Diffstat (limited to 'set/set.ha')
-rw-r--r--set/set.ha7
1 files changed, 6 insertions, 1 deletions
diff --git a/set/set.ha b/set/set.ha
index 2c56efe..504d716 100644
--- a/set/set.ha
+++ b/set/set.ha
@@ -33,11 +33,16 @@ export fn contains(s: set, item: size) (size | nosuchitem) = {
return nosuchitem;
};
-// Clears all items
+// Clears all items.
export fn clear(s: *set) void = {
delete(s.items[..]);
};
+// Free the underlying slice.
+export fn finish(s: *set) void = {
+ free(s.items);
+};
+
@test fn add() void = {
let s = set {...};
assert(add(&s, 1z));