2#include "../include/cppx.h"
14 : m_blocks(std::move(
other.m_blocks)), m_free_list(std::move(
other.m_free_list))
16 other.m_blocks.clear();
17 other.m_free_list.clear();
25 m_blocks = std::move(
other.m_blocks);
26 m_free_list = std::move(
other.m_free_list);
27 other.m_blocks.clear();
28 other.m_free_list.clear();
35 void *
ptr = get_slot();
44 m_free_list.push_back(
static_cast<void *
>(
node));
49 for (
auto *
blk : m_blocks)
57 if (!m_free_list.empty())
59 void *
ptr = m_free_list.back();
60 m_free_list.pop_back();
63 if (m_blocks.empty() || m_blocks.back()->used >= Block::CAPACITY)
65 m_blocks.push_back(
new Block());
67 auto &blk = *m_blocks.back();
68 void *ptr = blk.data + blk.used *
sizeof(Node<T>);
void deallocate(Node< T > *node)
NodePool & operator=(const NodePool &)=delete
Node< T > * allocate(Args &&...args)