feat(hash): support deleting objects from hash table

This commit is contained in:
fallenoak 2023-03-26 21:10:53 -05:00
parent ce1c33d88b
commit 355733263f
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
2 changed files with 7 additions and 0 deletions

View file

View file

@ -14,6 +14,7 @@ class TSHashTable {
// Member functions
void Clear();
void Delete(T* ptr);
T* Head();
void Insert(T* ptr, uint32_t hashval, const TKey& key);
T* New(const char* str, size_t extrabytes, uint32_t flags);
@ -61,6 +62,12 @@ void TSHashTable<T, TKey>::Clear() {
this->InternalClear(0);
}
template <class T, class TKey>
void TSHashTable<T, TKey>::Delete(T* ptr) {
this->Unlink(ptr);
this->InternalDelete(ptr);
}
template <class T, class TKey>
void TSHashTable<T, TKey>::Destroy() {
this->InternalClear(1);