30 #ifndef BIT_MEMORY_ALLOCATORS_BUMP_DOWN_ALLOCATOR_HPP 31 #define BIT_MEMORY_ALLOCATORS_BUMP_DOWN_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/memory_block.hpp" 41 #include "../utilities/owner.hpp" 42 #include "../utilities/pointer_utilities.hpp" 46 #include <type_traits> 77 using max_alignment = std::integral_constant<std::size_t,(1 << (
sizeof(std::size_t)-1))>;
120 std::size_t offset = 0 ) noexcept;
126 void deallocate( owner<void*> p, std::size_t size );
140 bool owns(
const void* p )
const noexcept;
163 using named_bump_down_allocator = detail::named_allocator<bump_down_allocator>;
168 #include "detail/bump_down_allocator.inl" bool owns(const void *p) const noexcept
Checks whether linear_allocator contains the pointer p.
void deallocate(owner< void *> p, std::size_t size)
Does nothing for linear_allocator. Use deallocate_all.
bump_down_allocator(memory_block block) noexcept
Constructs a linear_allocator.
void deallocate_all() noexcept
Deallocates everything from this allocator.
owner< 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.
An allocator that allocates memory in contiguous memory by 'bumping' the head pointer to lower memory...
allocator_info info() const noexcept
Gets the info about this allocator.
Wrapper around a block of memory, containing both the size and the address of the memory block...
This type is used to hold the generic information for a given allocator.