[map] Add item_t.destruct()

This commit is contained in:
Behdad Esfahbod 2022-11-17 16:14:16 -07:00
parent 7f83040836
commit 5c88715949
1 changed files with 6 additions and 2 deletions

View File

@ -95,9 +95,13 @@ struct hb_hashmap_t
is_used_ = false;
is_tombstone_ = false;
}
void reconstruct ()
void destruct ()
{
this->~item_t ();
}
void reconstruct ()
{
destruct ();
construct ();
}
@ -145,7 +149,7 @@ struct hb_hashmap_t
if (likely (items)) {
unsigned size = mask + 1;
for (unsigned i = 0; i < size; i++)
items[i].~item_t ();
items[i].destruct ();
hb_free (items);
items = nullptr;
}