bit::memory
|
An allocator that allocates memory in contiguous memory by 'bumping' the head pointer to higher memory addresses. More...
#include <bump_up_lifo_allocator.hpp>
Public Types | |
using | max_alignment = std::integral_constant< std::size_t, 256 > |
Public Member Functions | |
bump_up_lifo_allocator (memory_block block) noexcept | |
Constructs a bump_up_lifo_allocator. | |
bump_up_lifo_allocator (bump_up_lifo_allocator &&other) noexcept=default | |
Move-constructs a bump_up_lifo_allocator from another allocator. More... | |
bump_up_lifo_allocator (const bump_up_lifo_allocator &other)=delete | |
bump_up_lifo_allocator (nullblock_t)=delete | |
bump_up_lifo_allocator & | operator= (const bump_up_lifo_allocator &)=delete |
bump_up_lifo_allocator & | operator= (bump_up_lifo_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_lifo_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_lifo_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 offers 2 options for deallocations:
deallocate_all
deallocate
The two forms of deallocations are incompatible; either truncated deallocations can be used OR LIFO deallocations can be used.
Definition at line 73 of file bump_up_lifo_allocator.hpp.
|
defaultnoexcept |
Move-constructs a bump_up_lifo_allocator from another allocator.
other | the other bump_up_lifo_allocator to move |
void bit::memory::bump_up_lifo_allocator::deallocate | ( | owner< void *> | p, |
std::size_t | size | ||
) |
Does nothing for bump_up_lifo_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_lifo_allocator'. Use a named_bump_up_lifo_allocator to override this
|
noexcept |
Checks whether bump_up_lifo_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