diff --git a/parallel_hashmap/phmap.h b/parallel_hashmap/phmap.h index 437ec64..60d2030 100644 --- a/parallel_hashmap/phmap.h +++ b/parallel_hashmap/phmap.h @@ -2217,10 +2217,13 @@ protected: void emplace_at(size_t i, Args&&... args) { PolicyTraits::construct(&alloc_ref(), slots_ + i, std::forward(args)...); - + +#ifdef PHMAP_CHECK_CONSTRUCTED_VALUE + // this check can be costly, so do it only when requested assert(PolicyTraits::apply(FindElement{*this}, *iterator_at(i)) == iterator_at(i) && "constructed value does not match the lookup key"); +#endif } iterator iterator_at(size_t i) { return {ctrl_ + i, slots_ + i}; }