Add proper util::hash_table move constructor & assignment

This commit is contained in:
Nikita Lisitsa 2023-08-24 17:32:33 +03:00
parent 8adfe7320b
commit 183644d46f

View file

@ -115,6 +115,27 @@ namespace psemek::util
, Equal(std::forward<K>(k))
{}
hash_table_impl(hash_table_impl && other)
: Hash(std::move(other.hash()))
, Equal(std::move(other.equal()))
, storage_(std::move(other.storage_))
{
other.storage_.capacity = 0;
other.size_ = 0;
}
hash_table_impl & operator = (hash_table_impl && other)
{
if (this == &other)
return *this;
storage_ = std::move(other.storage_);
size_ = other.size_;
other.storage_.capacity = 0;
other.size_ = 0;
return *this;
}
Hash const & hash() const { return *this; }
Equal const & equal() const { return *this; }