common: slot_vector: added `IsAllocated` to check if a slot already exists
This commit is contained in:
parent
723e3cd0f9
commit
f375e0cfb0
|
@ -54,6 +54,13 @@ public:
|
|||
return values[id.index].object;
|
||||
}
|
||||
|
||||
bool IsAllocated(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 <typename... Args>
|
||||
[[nodiscard]] SlotId insert(Args&&... args) noexcept {
|
||||
const u32 index = FreeValueIndex();
|
||||
|
|
Loading…
Reference in New Issue