30 #ifndef BIT_MEMORY_ALLOCATORS_BUMP_UP_ALLOCATOR_HPP 31 #define BIT_MEMORY_ALLOCATORS_BUMP_UP_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> 69 using max_alignment = std::integral_constant<std::size_t,(1 << (
sizeof(std::size_t)-1))>;
112 std::size_t offset = 0 ) noexcept;
118 void deallocate( owner<void*> p, std::size_t size );
132 bool owns(
const void* p )
const noexcept;
155 using named_bump_up_allocator = detail::named_allocator<bump_up_allocator>;
160 #include "detail/bump_up_allocator.inl" void deallocate(owner< void *> p, std::size_t size)
Does nothing for bump_up_allocator. Use deallocate_all.
An allocator that allocates memory in contiguous memory by 'bumping' the head pointer to higher memor...
bool owns(const void *p) const noexcept
Checks whether bump_up_allocator contains the pointer p.
bump_up_allocator(memory_block block) noexcept
Constructs a bump_up_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.
Wrapper around a block of memory, containing both the size and the address of the memory block...
allocator_info info() const noexcept
Gets the info about this allocator.
This type is used to hold the generic information for a given allocator.