util/IntrusiveHashSet: add option `zero_initialized`

This commit is contained in:
Max Kellermann 2023-09-11 20:33:47 +02:00
parent 3e09f95b40
commit 7dff29bcd1
1 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,11 @@
struct IntrusiveHashSetOptions {
bool constant_time_size = false;
/**
* @see IntrusiveListOptions::zero_initialized
*/
bool zero_initialized = false;
};
template<IntrusiveHookMode mode=IntrusiveHookMode::NORMAL>
@ -141,7 +146,7 @@ class IntrusiveHashSet {
}
};
using Bucket = IntrusiveList<T, BucketHookTraits>;
using Bucket = IntrusiveList<T, BucketHookTraits, IntrusiveListOptions{.zero_initialized = options.zero_initialized}>;
std::array<Bucket, table_size> table;
using bucket_iterator = typename Bucket::iterator;