diff --git a/src/common/slot_vector.h b/src/common/slot_vector.h index 06c057c2..fa3e899b 100644 --- a/src/common/slot_vector.h +++ b/src/common/slot_vector.h @@ -54,6 +54,13 @@ public: return values[id.index].object; } + bool is_allocated(SlotId id) const { + if (id && id.index / 64 < stored_bitset.size()) { + return ((stored_bitset[id.index / 64] >> (id.index % 64)) & 1) != 0; + } + return false; + } + template [[nodiscard]] SlotId insert(Args&&... args) noexcept { const u32 index = FreeValueIndex();