|
waLBerla 7.3
|
Aligned memory allocator with offset.
| T | Element type to allocate. |
| Backend | Allocator backend satisfying the AllocatorBackend concept. |
#include <Allocators.hpp>
Classes | |
| struct | rebind |
Public Types | |
| using | value_type = T |
Public Member Functions | |
| Allocator () noexcept=default | |
| Allocator (size_t offset, size_t alignment) | |
| Construct an allocator with a given offset and alignment. | |
| T * | allocate (size_t n) |
| Allocate memory for n elements of type T. | |
| void | deallocate (T *ptr, size_t) noexcept |
| Deallocate memory previously allocated by allocate. | |
| size_t | offset () const noexcept |
| size_t | alignment () const noexcept |
| bool | operator== (const Allocator &) const noexcept |
| bool | operator!= (const Allocator &) const noexcept |
| template<typename U> | |
| Allocator (const Allocator< U, Backend > &other) noexcept | |
Private Attributes | |
| size_t | offset_ = 0 |
| size_t | align_ = alignof(T) |
| Backend | backend_ |
Static Private Attributes | |
| static std::map< void *, void * > | outerToBase |
| using walberla::v8::memory::Allocator< T, Backend >::value_type = T |
|
defaultnoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenodiscard |
Allocate memory for n elements of type T.
The returned (outer) pointer satisfies the offset and alignment requirement such that:
The original (base) pointer is stored internally and recovered during deallocation. Memory layout:
| n | Number of elements to allocate. |
| std::bad_array_new_length | if the allocation size overflows. |
| std::bad_alloc | if the offset is larger than the data itself. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
private |
|
private |
|
private |
|
inlinestaticprivate |