10 index_t allocatedIndex = 0;
11 if (freeList.empty()) {
12 if (nextFreeIndexNotInQueue == totalCount) {
14 throw std::out_of_range(
"Descriptor heap is full!");
17 allocatedIndex = nextFreeIndexNotInQueue;
18 nextFreeIndexNotInQueue++;
22 allocatedIndex = freeList.front();
26 return allocatedIndex;
29 void Deallocate(index_t index) {
31 if (index == nextFreeIndexNotInQueue) {
32 nextFreeIndexNotInQueue--;
36 freeList.emplace(index);
41 std::queue<index_t> freeList{};
42 index_t nextFreeIndexNotInQueue = 0;