Loading...
Searching...
No Matches
Dune::AlignedAllocator< T, Alignment > Class Template Reference
Common » Allocators

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

`#include <dune/common/alignedallocator.hh>`

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

## 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

  T | type of the object one wants to allocate
  Alignment | explicitly 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

inline inherited

## address() [2/2]

template<class T>

pointer Dune::MallocAllocator< T >::address | ( | reference | x | ) | const

inline inherited

## 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 )

inline inherited

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 )

inline inherited

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 )

inline inherited

deallocate n objects of type T at address p

## destroy()

template<class T>

void Dune::MallocAllocator< T >::destroy | ( | pointer | p | ) |

inline inherited

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

## max_size()

template<class T>

size_type Dune::MallocAllocator< T >::max_size | ( |  | ) | const

inline noexcept inherited

max size for allocate

## Member Data Documentation

## alignment

template<class T, int Alignment = -1>

int Dune::AlignedAllocator< T, Alignment >::alignment = fixAlignment(sizeof(void*))

static constexpr

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

- alignedallocator.hh