30 #ifndef BIT_MEMORY_ALLOCATORS_STACK_ALLOCATOR_HPP 31 #define BIT_MEMORY_ALLOCATORS_STACK_ALLOCATOR_HPP 33 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 35 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 37 #include "detail/named_allocator.hpp" 39 #include "../utilities/macros.hpp" 40 #include "../utilities/pointer_utilities.hpp" 43 #include <type_traits> 65 template<std::
size_t Size, std::
size_t Align = alignof(std::max_align_t)>
73 using max_alignment = std::integral_constant<std::size_t,Align>;
116 std::size_t offset = 0 ) noexcept;
136 bool owns(
const void* p )
const noexcept;
151 alignas(Align)
char m_storage[Size];
159 template<std::
size_t Size, std::
size_t Align = alignof(std::max_align_t)>
160 using named_stack_allocator = detail::named_allocator<stack_allocator<Size,Align>>;
165 #include "detail/stack_allocator.inl" bool owns(const void *p) const noexcept
Checks whether linear_allocator contains the pointer p.
void * try_allocate(std::size_t size, std::size_t align, std::size_t offset=0) noexcept
Tries to allocate memory of size size, aligned to the boundary align, offset by offset.
stack_allocator() noexcept
Default-constructs a stack_allocator.
void deallocate_all()
Deallocates all memory in this allocator.
allocator_info info() const noexcept
Gets the info about this allocator.
~stack_allocator()
Deallocates all memory from the stack.
A stack-allocation strategy that allocates off of stack-memory.
void deallocate(void *p, std::size_t size)
Does nothing for linear_allocator. Use deallocate_all.
This type is used to hold the generic information for a given allocator.