11static std::byte *
round_up(std::byte *x, std::size_t m)
13 auto y =
reinterpret_cast<uintptr_t
>(x);
14 y = ((y - 1) / m + 1) * m;
15 return reinterpret_cast<std::byte*
>(y);
56 buffers = std::move(other.buffers);
59 cursize = other.cursize;
60 nextsize = other.nextsize;
62 other.buffers.clear();
A Pool is a block allocator with the following characteristics:
T * allocate()
Convenience function: allocate a block of size and aligment for T.
std::vector< std::unique_ptr< std::byte[]> > buffers
void movefrom(Pool &other) noexcept
void resetblock() noexcept
void free_all() noexcept
Free all previous allocations, retaining the largest existing buffer for re-use.
Miscellaneous supporting code.
T constexpr round_up(T a, T b)
Returns a rounded up to the nearest multiple of b, assuming b >= 1.
std::vector< Buffer > buffers