MCKL
Monte Carlo Kernel Library
Classes | Public Member Functions | Related Functions | List of all members
mckl::Allocator< T, Mem > Class Template Reference

Standard library compatible allocator with policies. More...

#include <mckl/core/memory.hpp>

Inherits std::allocator< T >.

Classes

class  rebind
 

Public Member Functions

 Allocator ()=default
 
template<typename U >
 Allocator (const Allocator< U, Mem > &other) noexcept
 
T * allocate (std::size_t n, const void *hint=nullptr)
 
template<typename U >
void construct (U *p)
 
void deallocate (T *ptr, std::size_t size=0) noexcept(noexcept(Mem::deallocate(ptr, size)))
 

Related Functions

(Note that these are not member functions.)

template<typename T1 , typename T2 , typename Mem1 , typename Mem2 >
constexpr bool operator!= (const Allocator< T1, Mem1 > &, const Allocator< T2, Mem2 > &)
 
template<typename T1 , typename T2 , typename Mem1 , typename Mem2 >
constexpr bool operator== (const Allocator< T1, Mem1 > &, const Allocator< T2, Mem2 > &)
 

Detailed Description

template<typename T, typename Mem = Memory<AlignOf<T>>>
class mckl::Allocator< T, Mem >

Standard library compatible allocator with policies.

Template Parameters
TThe value type
MemThe memory allocation policy
See also
Allocator<void, Mem>
Allocator<const void, Mem>
std::allocator

Definition at line 322 of file memory.hpp.

Constructor & Destructor Documentation

◆ Allocator() [1/2]

template<typename T, typename Mem = Memory<AlignOf<T>>>
mckl::Allocator< T, Mem >::Allocator ( )
default

◆ Allocator() [2/2]

template<typename T, typename Mem = Memory<AlignOf<T>>>
template<typename U >
mckl::Allocator< T, Mem >::Allocator ( const Allocator< U, Mem > &  other)
inlinenoexcept

Definition at line 335 of file memory.hpp.

Member Function Documentation

◆ allocate()

template<typename T, typename Mem = Memory<AlignOf<T>>>
T* mckl::Allocator< T, Mem >::allocate ( std::size_t  n,
const void *  hint = nullptr 
)
inline

Definition at line 340 of file memory.hpp.

◆ construct()

template<typename T, typename Mem = Memory<AlignOf<T>>>
template<typename U >
void mckl::Allocator< T, Mem >::construct ( U *  p)
inline

Definition at line 362 of file memory.hpp.

◆ deallocate()

template<typename T, typename Mem = Memory<AlignOf<T>>>
void mckl::Allocator< T, Mem >::deallocate ( T *  ptr,
std::size_t  size = 0 
)
inlinenoexcept

Definition at line 355 of file memory.hpp.

Friends And Related Function Documentation

◆ operator!=()

template<typename T1 , typename T2 , typename Mem1 , typename Mem2 >
constexpr bool operator!= ( const Allocator< T1, Mem1 > &  ,
const Allocator< T2, Mem2 > &   
)
related

Definition at line 426 of file memory.hpp.

◆ operator==()

template<typename T1 , typename T2 , typename Mem1 , typename Mem2 >
constexpr bool operator== ( const Allocator< T1, Mem1 > &  ,
const Allocator< T2, Mem2 > &   
)
related

Definition at line 418 of file memory.hpp.