AutoPas  3.0.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
autopas::AlignedAllocator< T, Alignment > Class Template Reference

AlignedAllocator class. More...

#include <AlignedAllocator.h>

Classes

struct  rebind
 Equivalent allocator for other types Class whose member other is an alias of allocator for type U. More...
 

Public Types

using value_type = T
 value type
 
using pointer = T *
 pointer type
 
using const_pointer = const T *
 const pointer type
 
using reference = T &
 reference type
 
using const_reference = const T &
 const reference type
 
using size_type = size_t
 size type
 

Public Member Functions

 AlignedAllocator ()=default
 Default empty constructor.
 
template<class U >
 AlignedAllocator (const AlignedAllocator< U, Alignment > &)
 Copy constructor.
 
 ~AlignedAllocator ()=default
 Default destructor.
 
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.
 
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.
 

Detailed Description

template<class T, size_t Alignment = DEFAULT_CACHE_LINE_SIZE>
class autopas::AlignedAllocator< T, Alignment >

AlignedAllocator class.

Template Parameters
T
Alignment

Member Function Documentation

◆ allocate()

template<class T , size_t Alignment = DEFAULT_CACHE_LINE_SIZE>
T * autopas::AlignedAllocator< T, Alignment >::allocate ( std::size_t  n)
inline

Allocate aligned memory for n objects of type T.

Parameters
nsize to allocate
Returns
Pointer to the allocated memory

◆ construct()

template<class T , size_t Alignment = DEFAULT_CACHE_LINE_SIZE>
template<class U , class... Args>
void autopas::AlignedAllocator< T, Alignment >::construct ( U *  p,
Args &&...  args 
)
inline

Construct object of type U at already allocated memory, pointed to by p.

Parameters
ppointer to the object
argsarguments for the construction

◆ deallocate()

template<class T , size_t Alignment = DEFAULT_CACHE_LINE_SIZE>
void autopas::AlignedAllocator< T, Alignment >::deallocate ( T *  ptr,
std::size_t   
)
inline

Deallocate memory pointed to by ptr.

Parameters
ptrpointer to deallocate

◆ destroy()

template<class T , size_t Alignment = DEFAULT_CACHE_LINE_SIZE>
template<class U >
void autopas::AlignedAllocator< T, Alignment >::destroy ( U *  p)
inline

Destroy object pointed to by p, but does not deallocate the memory.

Parameters
ppointer to the object that should be destroyed

◆ max_size()

template<class T , size_t Alignment = DEFAULT_CACHE_LINE_SIZE>
size_t autopas::AlignedAllocator< T, Alignment >::max_size ( ) const
inlinenoexcept

Returns maximum possible value of n, with which we can call allocate(n)

Returns
maximum size possible to allocate

The documentation for this class was generated from the following file: