From a72f1753af9d16476871e624a11fdbe26dbc1c74 Mon Sep 17 00:00:00 2001 From: Jelmer van der Linde Date: Mon, 3 Jul 2023 16:22:11 +0100 Subject: [PATCH 1/2] Add `Reserve()` method to `AutoProbing` An implementation that's not re-allocating in a while loop is left as an exercise to the reader --- util/probing_hash_table.hh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/util/probing_hash_table.hh b/util/probing_hash_table.hh index c1965b4..eae3f78 100644 --- a/util/probing_hash_table.hh +++ b/util/probing_hash_table.hh @@ -393,10 +393,19 @@ template Date: Mon, 3 Jul 2023 16:23:10 +0100 Subject: [PATCH 2/2] Make `AutoProbing` move-assignable --- util/mmap.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util/mmap.hh b/util/mmap.hh index cd35eff..a8f8f43 100644 --- a/util/mmap.hh +++ b/util/mmap.hh @@ -82,6 +82,14 @@ class scoped_memory { : data_(from.data_), size_(from.size_), source_(from.source_) { from.steal(); } + + scoped_memory &operator=(scoped_memory &&from) noexcept { + reset(); + size_ = from.size_; + source_ = from.source_; + data_ = from.steal(); + return *this; + } #endif ~scoped_memory() { reset(); }