vSMC
vSMC: Scalable Monte Carlo
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
vsmc::AlignedAllocator< T, Alignment, Memory > Class Template Reference

Aligned allocator. More...

#include <vsmc/utility/aligned_memory.hpp>

Classes

class  rebind
 

Public Types

using const_pointer = const T *
 
using const_reference = typename std::add_lvalue_reference< const T >::type
 
using difference_type = std::ptrdiff_t
 
using is_always_equal = std::true_type
 
using pointer = T *
 
using reference = typename std::add_lvalue_reference< T >::type
 
using size_type = std::size_t
 
using value_type = T
 

Public Member Functions

 AlignedAllocator ()=default
 
 AlignedAllocator (const AlignedAllocator< T, Alignment, Memory > &)=default
 
template<typename U >
 AlignedAllocator (const AlignedAllocator< U, Alignment, Memory > &other)
 

Static Public Member Functions

static pointer allocate (size_type n, const void *=nullptr)
 
static void deallocate (pointer ptr, size_type)
 

Detailed Description

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
class vsmc::AlignedAllocator< T, Alignment, Memory >

Aligned allocator.

Template Parameters
TThe value type
AlignmentThe alignment requirement of memory, must be a power of two and no less than sizeof(void *).
MemoryThe memory management class. Must provides two static member functions, aligned_malloc and aligned_free. The member function aligned_malloc shall behave similar to std::malloc but take an additional arguments for alignment. The member function aligned_free shall behave just like std::free.

Definition at line 253 of file aligned_memory.hpp.

Member Typedef Documentation

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
using vsmc::AlignedAllocator< T, Alignment, Memory >::const_pointer = const T *

Definition at line 267 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
using vsmc::AlignedAllocator< T, Alignment, Memory >::const_reference = typename std::add_lvalue_reference<const T>::type

Definition at line 269 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
using vsmc::AlignedAllocator< T, Alignment, Memory >::difference_type = std::ptrdiff_t

Definition at line 265 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
using vsmc::AlignedAllocator< T, Alignment, Memory >::is_always_equal = std::true_type

Definition at line 270 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
using vsmc::AlignedAllocator< T, Alignment, Memory >::pointer = T *

Definition at line 266 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
using vsmc::AlignedAllocator< T, Alignment, Memory >::reference = typename std::add_lvalue_reference<T>::type

Definition at line 268 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
using vsmc::AlignedAllocator< T, Alignment, Memory >::size_type = std::size_t

Definition at line 264 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
using vsmc::AlignedAllocator< T, Alignment, Memory >::value_type = T

Definition at line 263 of file aligned_memory.hpp.

Constructor & Destructor Documentation

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
vsmc::AlignedAllocator< T, Alignment, Memory >::AlignedAllocator ( )
default
template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
vsmc::AlignedAllocator< T, Alignment, Memory >::AlignedAllocator ( const AlignedAllocator< T, Alignment, Memory > &  )
default
template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
template<typename U >
vsmc::AlignedAllocator< T, Alignment, Memory >::AlignedAllocator ( const AlignedAllocator< U, Alignment, Memory > &  other)
inline

Definition at line 284 of file aligned_memory.hpp.

Member Function Documentation

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
static pointer vsmc::AlignedAllocator< T, Alignment, Memory >::allocate ( size_type  n,
const void *  = nullptr 
)
inlinestatic

Definition at line 289 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
static void vsmc::AlignedAllocator< T, Alignment, Memory >::deallocate ( pointer  ptr,
size_type   
)
inlinestatic

Definition at line 298 of file aligned_memory.hpp.