COMMON: Replace NDEBUG define checks with RELEASE_BUILD

This commit is contained in:
Filippos Karapetis 2024-09-20 11:21:37 +03:00
parent 6814b99b67
commit a689ba0d95

View File

@ -451,7 +451,7 @@ template<class Key, class Val, class HashFunc, class EqualFunc>
void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(size_type newCapacity) {
assert(newCapacity > _mask + 1);
#ifndef NDEBUG
#ifndef RELEASE_BUILD
const size_type old_size = _size;
#endif
const size_type old_mask = _mask;
@ -484,9 +484,11 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(size_type newCapacity
_size++;
}
#ifndef RELEASE_BUILD
// Perform a sanity check: Old number of elements should match the new one!
// This check will fail if some previous operation corrupted this hashmap.
assert(_size == old_size);
#endif
delete[] old_storage;