[map] Construct objects

This commit is contained in:
Behdad Esfahbod 2022-01-13 12:38:26 -07:00
parent b15e497d4d
commit 114046dc27
1 changed files with 8 additions and 1 deletions

View File

@ -75,7 +75,14 @@ struct hb_hashmap_t
V value;
uint32_t hash;
void clear () { key = kINVALID; value = vINVALID; hash = 0; }
void clear ()
{
new (hb_addressof (key)) K ();
key = kINVALID;
new (hb_addressof (value)) V ();
value = vINVALID;
hash = 0;
}
bool operator == (const K &o) { return hb_deref (key) == hb_deref (o); }
bool operator == (const item_t &o) { return *this == o.key; }