dune-common 2.9.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
Dune::AlignedAllocator< T, Alignment > Class Template Reference

Allocators which guarantee alignment of the memory. More...

#include <dune/common/alignedallocator.hh>

Inheritance diagram for Dune::AlignedAllocator< T, Alignment >:
Inheritance graph

Classes

struct  rebind
 

Public Types

using pointer = typename MallocAllocator< T >::pointer
 
using size_type = typename MallocAllocator< T >::size_type
 
typedef std::ptrdiff_t difference_type
 
typedef const T * const_pointer
 
typedef T & reference
 
typedef const T & const_reference
 
typedef T value_type
 

Public Member Functions

pointer allocate (size_type n, const void *hint=0)
 allocate n objects of type T
 
pointer address (reference x) const
 
const_pointer address (const_reference x) const
 
void deallocate (pointer p, size_type n)
 deallocate n objects of type T at address p
 
size_type max_size () const noexcept
 max size for allocate
 
void construct (pointer p, const T &val)
 copy-construct an object of type T (i.e. make a placement new on p)
 
template<typename ... Args>
void construct (pointer p, Args &&... args)
 construct an object of type T from variadic parameters
 
void destroy (pointer p)
 destroy an object of type T (i.e. call the destructor)
 

Static Public Attributes

static constexpr int alignment = fixAlignment(sizeof(void*))
 

Detailed Description

template<class T, int Alignment = -1>
class Dune::AlignedAllocator< T, Alignment >

Allocators which guarantee alignment of the memory.

Template Parameters
Ttype of the object one wants to allocate
Alignmentexplicitly specify the alignment, by default it is std::alignment_of<T>::value

Member Typedef Documentation

◆ const_pointer

template<class T >
typedef const T* Dune::MallocAllocator< T >::const_pointer
inherited

◆ const_reference

template<class T >
typedef const T& Dune::MallocAllocator< T >::const_reference
inherited

◆ difference_type

template<class T >
typedef std::ptrdiff_t Dune::MallocAllocator< T >::difference_type
inherited

◆ pointer

template<class T , int Alignment = -1>
using Dune::AlignedAllocator< T, Alignment >::pointer = typename MallocAllocator<T>::pointer

◆ reference

template<class T >
typedef T& Dune::MallocAllocator< T >::reference
inherited

◆ size_type

template<class T , int Alignment = -1>
using Dune::AlignedAllocator< T, Alignment >::size_type = typename MallocAllocator<T>::size_type

◆ value_type

template<class T >
typedef T Dune::MallocAllocator< T >::value_type
inherited

Member Function Documentation

◆ address() [1/2]

template<class T >
const_pointer Dune::MallocAllocator< T >::address ( const_reference  x) const
inlineinherited

◆ address() [2/2]

template<class T >
pointer Dune::MallocAllocator< T >::address ( reference  x) const
inlineinherited

◆ allocate()

template<class T , int Alignment = -1>
pointer Dune::AlignedAllocator< T, Alignment >::allocate ( size_type  n,
const void *  hint = 0 
)
inline

allocate n objects of type T

◆ construct() [1/2]

template<class T >
template<typename ... Args>
void Dune::MallocAllocator< T >::construct ( pointer  p,
Args &&...  args 
)
inlineinherited

construct an object of type T from variadic parameters

◆ construct() [2/2]

template<class T >
void Dune::MallocAllocator< T >::construct ( pointer  p,
const T &  val 
)
inlineinherited

copy-construct an object of type T (i.e. make a placement new on p)

◆ deallocate()

template<class T >
void Dune::MallocAllocator< T >::deallocate ( pointer  p,
size_type  n 
)
inlineinherited

deallocate n objects of type T at address p

◆ destroy()

template<class T >
void Dune::MallocAllocator< T >::destroy ( pointer  p)
inlineinherited

destroy an object of type T (i.e. call the destructor)

◆ max_size()

template<class T >
size_type Dune::MallocAllocator< T >::max_size ( ) const
inlinenoexceptinherited

max size for allocate

Member Data Documentation

◆ alignment

template<class T , int Alignment = -1>
constexpr int Dune::AlignedAllocator< T, Alignment >::alignment = fixAlignment(sizeof(void*))
staticconstexpr

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