bit::memory
|
An allocator that allocates memory in contiguous memory by 'bumping' the head pointer to higher memory addresses. More...
#include <bump_up_allocator.hpp>
Public Types | |
using | max_alignment = std::integral_constant< std::size_t,(1<<(sizeof(std::size_t) -1))> |
Public Member Functions | |
bump_up_allocator (memory_block block) noexcept | |
Constructs a bump_up_allocator. | |
bump_up_allocator (bump_up_allocator &&other) noexcept=default | |
Move-constructs a bump_up_allocator from another allocator. More... | |
bump_up_allocator (const bump_up_allocator &other)=delete | |
bump_up_allocator (nullblock_t)=delete | |
bump_up_allocator & | operator= (const bump_up_allocator &)=delete |
bump_up_allocator & | operator= (bump_up_allocator &&other)=delete |
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 . More... | |
void | deallocate (owner< void *> p, std::size_t size) |
Does nothing for bump_up_allocator. Use deallocate_all. More... | |
void | deallocate_all () noexcept |
Deallocates everything from this allocator. | |
bool | owns (const void *p) const noexcept |
Checks whether bump_up_allocator contains the pointer p . More... | |
allocator_info | info () const noexcept |
Gets the info about this allocator. More... | |
An allocator that allocates memory in contiguous memory by 'bumping' the head pointer to higher memory addresses.
Allocations are distributed in an increasing memory-address pattern.
This allocator can only deallocate memory with truncated deallocations through deallocate_all
Definition at line 62 of file bump_up_allocator.hpp.
|
defaultnoexcept |
Move-constructs a bump_up_allocator from another allocator.
other | the other bump_up_allocator to move |
void bit::memory::bump_up_allocator::deallocate | ( | owner< void *> | p, |
std::size_t | size | ||
) |
Does nothing for bump_up_allocator. Use deallocate_all.
p | the pointer |
size | the size of the allocation |
|
noexcept |
Gets the info about this allocator.
This defaults to 'bump_up_allocator'. Use a named_bump_up_allocator to override this
|
noexcept |
Checks whether bump_up_allocator
contains the pointer p
.
p | the pointer to check |
true
if p
is contained in this allocator
|
noexcept |
Tries to allocate memory of size size
, aligned to the boundary align
, offset by offset
.
size | the size of the allocation |
align | the requested alignment of the allocation |
offset | the amount to offset the alignment by |
nullptr
on failure