![]() |
MAGE
v0.171.0
Matthias Advanced Game Engine
|
#include <allocation.hpp>
Classes | |
struct | rebind |
Public Types | |
using | value_type = T |
using | size_type = std::size_t |
using | difference_type = std::ptrdiff_t |
using | propagate_on_container_move_assignment = std::true_type |
using | is_always_equal = std::true_type |
Public Member Functions | |
constexpr | AlignedAllocator () noexcept=default |
constexpr | AlignedAllocator (const AlignedAllocator &allocator) noexcept=default |
constexpr | AlignedAllocator (AlignedAllocator &&allocator) noexcept=default |
template<typename U > | |
constexpr | AlignedAllocator ([[maybe_unused]] const AlignedAllocator< U, A > &allocator) noexcept |
~AlignedAllocator ()=default | |
AlignedAllocator & | operator= (const AlignedAllocator &allocator) noexcept=default |
AlignedAllocator & | operator= (AlignedAllocator &&allocator) noexcept=default |
T * | allocate (std::size_t count) const |
T * | allocate (std::size_t count, [[maybe_unused]] const void *hint) const |
void | deallocate (T *data, [[maybe_unused]] std::size_t count) const noexcept |
template<typename U > | |
constexpr bool | operator== ([[maybe_unused]] const AlignedAllocator< U, A > &rhs) const noexcept |
template<typename U > | |
constexpr bool | operator!= ([[maybe_unused]] const AlignedAllocator< U, A > &rhs) const noexcept |
A class of aligned allocators.
T | The data type. |
A | The alignment in bytes. |
using mage::AlignedAllocator< T, A >::difference_type = std::ptrdiff_t |
using mage::AlignedAllocator< T, A >::is_always_equal = std::true_type |
using mage::AlignedAllocator< T, A >::propagate_on_container_move_assignment = std::true_type |
using mage::AlignedAllocator< T, A >::size_type = std::size_t |
using mage::AlignedAllocator< T, A >::value_type = T |
|
defaultnoexcept |
Constructs an aligned allocator.
|
defaultnoexcept |
Constructs an aligned allocator from the given aligned allocator.
[in] | allocator | A reference to the aligned allocator to copy. |
|
defaultnoexcept |
Constructs an aligned allocator by moving the given aligned allocator.
[in] | allocator | A reference to the aligned allocator to move. |
|
noexcept |
Constructs an aligned allocator from the given aligned allocator.
U | The data type. |
[in] | allocator | A reference to the aligned allocator to copy. |
|
default |
Destructs this aligned allocator.
T* mage::AlignedAllocator< T, A >::allocate | ( | std::size_t | count | ) | const |
Allocates a block of storage with a size large enough to contain count elements of type T
, and returns a pointer to the first element.
[in] | count | The number of objects of type T to allocate in memory. |
A
. std::bad_alloc | Failed to allocate the memory block. |
T* mage::AlignedAllocator< T, A >::allocate | ( | std::size_t | count, |
[[maybe_unused] ] const void * | hint | ||
) | const |
Allocates a block of storage with a size large enough to contain count elements of type T
, and returns a pointer to the first element.
[in] | count | The number of objects of type T to allocate in memory. |
[in] | hint | Either nullptr or a value previously obtained by another call to mage::AlignedAllocator<T,std::size_t>::allocate(std::size_t) and not yet freed with mage::AlignedAllocator<T,std::size_t>::deallocate(T*, std::size_t). When not equal to nullptr , this value may be used as a hint to improve performance by allocating the new block near the one specified. The address of an adjacent element is often a good choice. |
A
. std::bad_alloc | Failed to allocate the memory block. |
|
noexcept |
Releases a block of storage previously allocated with mage::AlignedAllocator<T,std::size_t>::allocate(std::size_t) and not yet released.
[in] | data | A pointer to the memory block that needs to be released. |
[in] | count | The number of objects of type T allocated on the call to allocate this block of storage. |
|
noexcept |
Compares this aligned allocator to the given aligned allocator for non-equality.
U | The data type. |
[in] | rhs | A reference to the aligned allocator to compare with. |
true
if and only if storage allocated from this aligned allocator cannot be deallocated from the given aligned allocator, and vice versa. This is never the case for stateless allocators. false
otherwise.
|
defaultnoexcept |
Copies the given aligned allocator to this aligned allocator.
[in] | allocator | A reference to the aligned allocator to copy. |
|
defaultnoexcept |
Moves the given aligned allocator to this aligned allocator.
[in] | allocator | A reference to the aligned allocator to move. |
|
noexcept |
Compares this aligned allocator to the given aligned allocator for equality.
U | The data type. |
[in] | rhs | A reference to the aligned allocator to compare with. |
true
if and only if storage allocated from this aligned allocator can be deallocated from the given aligned allocator, and vice versa. This is always the case for stateless allocators. false
otherwise.