diff --git a/ExcaliburHash/ExcaliburHash.h b/ExcaliburHash/ExcaliburHash.h index 9ae77f7..0fdc6b2 100644 --- a/ExcaliburHash/ExcaliburHash.h +++ b/ExcaliburHash/ExcaliburHash.h @@ -258,7 +258,6 @@ template value(); TValue* otherValue = otherInlineItem.value(); construct(value, std::move(*otherValue)); - destruct(otherValue); + + if constexpr (!std::is_trivially_destructible::value) + { + destruct(otherValue); + } } } } @@ -829,42 +832,6 @@ template ::end(*this)) - { - return false; - } - - EXLBR_ASSERT(m_numElements != 0); - m_numElements--; - - if constexpr ((!std::is_trivially_destructible::value) && (has_values::value)) - { - TValue* itemValue = const_cast(it.getValue()); - destruct(itemValue); - } - - // hash table now is empty. convert all tombstones to empty keys - if (m_numElements == 0) - { - TItem* EXLBR_RESTRICT item = m_storage; - TItem* const endItem = item + m_numBuckets; - for (; item != endItem; item++) - { - *item->key() = TKeyInfo::getEmpty(); - } - return true; - } - - // overwrite key with empty key - TKey* itemKey = const_cast(it.getKey()); - *itemKey = TKeyInfo::getTombstone(); - return true; - } - */ - inline bool erase(const TKey& key) { auto it = find(key);