Class AlignedHeapAllocator¶
Defined in File aligned_heap_allocator.hpp
Class Documentation¶
-
class
wrench
::
AlignedHeapAllocator
¶ This type implements an allocator which allocates aligned memory on the heap. It’s the slowest allocator, and should therefore always be used as the last resort allocator.
Public Types
-
using
Self
= AlignedHeapAllocator¶ Defines the type of the allocator.
Public Functions
-
AlignedHeapAllocator
() = default¶ Default constructor.
-
~AlignedHeapAllocator
() = default¶ Destructor defaulted.
-
template<typename
Arena
>AlignedHeapAllocator
(const Arena &arena)¶ Constructor which takes an Arena, which is provided for compatability with other allocators.
- Parameters
arena
: The area to allocate memory from. Unused by this allocator.
- Template Parameters
Arena
: The type of the arena.
-
AlignedHeapAllocator
(AlignedHeapAllocator&&) noexcept = default¶ Move construcor defaulted.
-
auto operator= (AlignedHeapAllocator &&) noexcept -> Self &=default
Move assignment defaulted.
-
AlignedHeapAllocator
(const AlignedHeapAllocator&) = delete¶ Copy constructor deleted since allocators can’t be moved.
-
auto operator= (const AlignedHeapAllocator &) -> Self &=delete
Copy assignment deleted since allocators can’t be copied.
-
auto alloc (size_t size, size_t alignment) noexcept -> void *
Allocates
size
bytes of memory withalign
alignment.- Parameters
size
: The size of the memory to allocate.alignment
: The alignment of the allocation.
-
auto free (void *ptr) noexcept -> void
Frees the memory pointed to by ptr.
- Parameters
ptr
: The pointer to the memory to free.
-
auto free (void *ptr, size_t) noexcept -> void
Frees the memory pointed to by
ptr
.- Parameters
ptr
: The pointer to the memory to free.
-
using