#pragma once #include "handle-fwd.hpp" #include "compat/defs.hpp" #include #include namespace floormat::impl_handle { template struct Item { union { Obj object; }; Handle handle; uint32_t next; }; template class Page { friend struct Handle; std::array, PageSize> storage; BitArray used_map; // todo replace with a rewrite of std::bitset uint32_t start_index; uint32_t used_count = 0; uint32_t first_free = (uint32_t)-1; public: fm_DECLARE_DELETED_COPY_MOVE_ASSIGNMENTS(Page); explicit Page(uint32_t start_index); ~Page() noexcept; [[nodiscard]] Item& allocate(); void deallocate(Handle obj); bool is_empty(); bool is_full(); }; } // namespace floormat::impl_handle