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::allocate() and blaze::deallocate() functions to guarantee properly aligned memory based on the alignment restrictions of the specified type Type. 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.
More...
#include <AlignedAllocator.h>
template<typename Type>
class blaze::AlignedAllocator< Type >
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::allocate() and blaze::deallocate() functions to guarantee properly aligned memory based on the alignment restrictions of the specified type Type. 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.
◆ AlignedAllocator()
template<typename Type >
template<typename Type2 >
Conversion constructor from different AlignedAllocator instances.
- Parameters
-
allocator | The foreign aligned allocator to be copied. |
◆ address()
Returns the address of the given element.
- Returns
- The address of the given element.
◆ allocate()
Allocates aligned memory for the specified number of objects.
- Parameters
-
numObjects | The number of objects to be allocated. |
localityHint | Hint for improved locality. |
- Returns
- Pointer to the newly allocated memory.
This function allocates a junk of memory for the specified number of objects of type Type. The returned pointer is guaranteed to be aligned according to the alignment restrictions of the data type Type. 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.
◆ construct()
Constructs an object of type Type at the specified memory location.
- Parameters
-
ptr | Pointer to the allocated, uninitialized storage. |
value | The initialization value. |
- Returns
- void
This function constructs an object of type Type in the allocated, uninitialized storage pointed to by ptr. This construction is performed via placement-new.
◆ deallocate()
Deallocation of memory.
- Parameters
-
ptr | The address of the first element of the array to be deallocated. |
numObjects | The number of objects to be deallocated. |
- Returns
- void
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.
◆ destroy()
Destroys the object of type Type at the specified memory location.
- Parameters
-
ptr | Pointer to the object to be destroyed. |
- Returns
- void
This function destroys the object at the specified memory location via a direct call to its destructor.
◆ max_size()
Returns the maximum possible number of elements that can be allocated together.
- Returns
- The maximum number of elements that can be allocated together.
The documentation for this class was generated from the following file: