4#ifndef WPI_MEMORY_STATIC_ALLOCATOR_HPP_INCLUDED
5#define WPI_MEMORY_STATIC_ALLOCATOR_HPP_INCLUDED
18#if WPI_MEMORY_EXTERN_TEMPLATE
31 template <std::
size_t Size>
57 template <std::
size_t Size>
59 : stack_(&storage), end_(stack_.top() + Size)
76 return static_cast<std::size_t
>(end_ - stack_.
top());
83 return std::size_t(-1);
89 detail::fixed_memory_stack stack_;
93#if WPI_MEMORY_EXTERN_TEMPLATE
113 template <std::
size_t Size>
116 : cur_(
static_cast<char*
>(
static_cast<void*
>(&storage))),
118 block_size_(block_size)
130 : cur_(other.cur_), end_(other.end_), block_size_(other.block_size_)
132 other.cur_ = other.end_ =
nullptr;
133 other.block_size_ = 0;
173 std::
size_t block_size_;
The default specialization of the wpi::memory::allocator_traits.
The default specialization of the allocator_traits for a RawAllocator.
Definition allocator_traits.hpp:292
char * top() const noexcept
Definition memory_stack.hpp:107
A stateful RawAllocator that uses a fixed sized storage for the allocations.
Definition static_allocator.hpp:48
static_allocator(static_allocator_storage< Size > &storage) noexcept
Definition static_allocator.hpp:58
void * allocate_node(std::size_t size, std::size_t alignment)
std::size_t max_node_size() const noexcept
Definition static_allocator.hpp:74
std::true_type is_stateful
Definition static_allocator.hpp:50
void deallocate_node(void *, std::size_t, std::size_t) noexcept
Definition static_allocator.hpp:71
std::size_t max_alignment() const noexcept
Definition static_allocator.hpp:81
A BlockAllocator that allocates the blocks from a fixed size storage.
Definition static_allocator.hpp:105
~static_block_allocator() noexcept=default
friend void swap(static_block_allocator &a, static_block_allocator &b) noexcept
Definition static_allocator.hpp:146
static_block_allocator & operator=(static_block_allocator &&other) noexcept
Definition static_allocator.hpp:136
static_block_allocator(std::size_t block_size, static_allocator_storage< Size > &storage) noexcept
Definition static_allocator.hpp:114
void deallocate_block(memory_block block) noexcept
memory_block allocate_block()
std::size_t next_block_size() const noexcept
Definition static_allocator.hpp:164
detail namespace with internal helper functions
Definition input_adapters.h:32
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
void adl_swap(T &a, T &b) noexcept
Definition utility.hpp:60
constexpr std::size_t max_alignment
Definition align.hpp:42
std::remove_reference< T >::type && move(T &&arg) noexcept
Definition utility.hpp:25
Memory namespace.
Definition heap_allocator.hpp:20
Foonathan namespace.
Definition ntcore_cpp.h:26
void swap(expected< T, E > &lhs, expected< T, E > &rhs) noexcept(noexcept(lhs.swap(rhs)))
Definition expected:2438
Contains information about an allocator.
Definition error.hpp:23
A memory block.
Definition memory_arena.hpp:28
Storage for a static_allocator.
Definition static_allocator.hpp:33
char storage[Size]
Definition static_allocator.hpp:34
#define WPI_MEMORY_ASSERT(Expr)
Definition assert.hpp:46