![]() |
Blaze 3.9
|
Allocator for type-specific aligned memory. More...
#include <AlignedAllocator.h>
Classes | |
struct | rebind |
Implementation of the AlignedAllocator rebind mechanism. More... | |
Public Types | |
using | ValueType = T |
Type of the allocated values. | |
using | SizeType = size_t |
Size type of the aligned allocator. | |
using | DifferenceType = ptrdiff_t |
Difference type of the aligned allocator. | |
using | value_type = ValueType |
Type of the allocated values. | |
using | size_type = SizeType |
Size type of the aligned allocator. | |
using | difference_type = DifferenceType |
Difference type of the aligned allocator. | |
Public Member Functions | |
Constructors | |
AlignedAllocator ()=default | |
template<typename U > | |
AlignedAllocator (const AlignedAllocator< U > &) | |
Conversion constructor from different AlignedAllocator instances. More... | |
Allocation functions | |
T * | allocate (size_t numObjects) |
Allocates aligned memory for the specified number of objects. More... | |
void | deallocate (T *ptr, size_t numObjects) noexcept |
Deallocation of memory. More... | |
Allocator for type-specific aligned memory.
The AlignedAllocator class template represents an implementation of the allocator concept of the standard library for the allocation of type-specific, aligned, uninitialized memory. The allocator performs its allocation via the blaze::alignedAllocate() and blaze::alignedDeallocate() functions to guarantee properly aligned memory based on the alignment restrictions of the specified type T. For instance, in case the given type is a fundamental, built-in data type and in case SSE vectorization is possible, the returned memory is guaranteed to be at least 16-byte aligned. In case AVX is active, the memory is even guaranteed to be at least 32-byte aligned.
|
inline |
Conversion constructor from different AlignedAllocator instances.
allocator | The foreign aligned allocator to be copied. |
|
inline |
Allocates aligned memory for the specified number of objects.
numObjects | The number of objects to be allocated. |
This function allocates a junk of memory for the specified number of objects of type T. The returned pointer is guaranteed to be aligned according to the alignment restrictions of the data type T. For instance, in case the type is a fundamental, built-in data type and in case SSE vectorization is possible, the returned memory is guaranteed to be at least 16-byte aligned. In case AVX is active, the memory is even guaranteed to be 32-byte aligned.
|
inlinenoexcept |
Deallocation of memory.
ptr | The address of the first element of the array to be deallocated. |
numObjects | The number of objects to be deallocated. |
This function deallocates a junk of memory that was previously allocated via the allocate() function. Note that the argument numObjects must be equal ot the first argument of the call to allocate() that origianlly produced ptr.