summaryrefslogtreecommitdiffhomepage
path: root/src/handle-page.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/handle-page.hpp')
-rw-r--r--src/handle-page.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/handle-page.hpp b/src/handle-page.hpp
index bf7ecdad..7afad5f8 100644
--- a/src/handle-page.hpp
+++ b/src/handle-page.hpp
@@ -9,7 +9,10 @@ namespace floormat::impl_handle {
template<typename Obj, uint32_t PageSize>
struct Item
{
+ fm_DECLARE_DELETED_COPY_MOVE_ASSIGNMENTS(Item);
+ Item();
~Item() noexcept;
+
union { char empty = {}; Obj object; };
Handle<Obj, PageSize> handle;
uint32_t next;
@@ -23,8 +26,9 @@ class Page
std::array<Item<Obj, PageSize>, 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;
+ uint32_t used_count;
+ uint32_t first_free;
+ bool locked;
static void do_deallocate(Item<Obj, PageSize>& item);
@@ -43,6 +47,7 @@ public:
void deallocate_all();
bool is_empty();
bool is_full();
+ uint32_t use_count() const;
};
} // namespace floormat::impl_handle