From 5550ed849cb0f9947cc4bb837b062bb9723dcbbf Mon Sep 17 00:00:00 2001 From: Felix Brendel Date: Sun, 20 Dec 2020 16:13:55 +0100 Subject: [PATCH] clear --- bucket_allocator.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bucket_allocator.hpp b/bucket_allocator.hpp index 14fa9c8..5e55efb 100644 --- a/bucket_allocator.hpp +++ b/bucket_allocator.hpp @@ -11,6 +11,12 @@ struct Bucket_Allocator { Array_List free_list; type** buckets; + void clear() { + next_index_in_latest_bucket = 0; + next_bucket_index = 0; + free_list.clear(); + } + void expand() { buckets = (type**)realloc(buckets, bucket_count * 2 * sizeof(type*)); bucket_count *= 2;