ls1-MarDyn
ls1-MarDyn molecular dynamics code
|
A custom allocator to get aligned memory. More...
#include <AlignedAllocator.h>
Classes | |
struct | rebind |
Public Types | |
typedef T | value_type |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef T & | reference |
typedef const T & | const_reference |
typedef size_t | size_type |
Public Member Functions | |
AlignedAllocator ()=default | |
Default constructor. | |
template<class U > | |
AlignedAllocator (const AlignedAllocator< U, Alignment > &) | |
Copy constructor. | |
size_t | max_size () const noexcept |
Returns maximum possible value of n, with which we can call allocate(n) | |
T * | allocate (std::size_t n) |
Allocate aligned memory for n objects of type T. More... | |
void | deallocate (T *ptr, std::size_t) |
Deallocate memory pointed to by ptr. | |
template<class U , class ... Args> | |
void | construct (U *p, Args &&... args) |
Construct object of type U at already allocated memory, pointed to by p. | |
template<class U > | |
void | destroy (U *p) |
Destroy object pointed to by p, but does not deallocate the memory. | |
A custom allocator to get aligned memory.
This allocator is intended to be used by std::vector
T | The type of the elements this class should allocate memory for |
alignment | The alignment restriction. Must be a power of 2, should not be 8. |
|
inline |
Allocate aligned memory for n objects of type T.