vSMC
vSMC: Scalable Monte Carlo
Classes | Public Types | 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 pointer = typename std::allocator< T >::pointer
 
using size_type = typename std::allocator< T >::size_type
 

Public Member Functions

 AlignedAllocator ()
 
 AlignedAllocator (const AlignedAllocator< T, Alignment, Memory > &other)
 
template<typename U >
 AlignedAllocator (const AlignedAllocator< U, Alignment, Memory > &other)
 
 AlignedAllocator (AlignedAllocator< T, Alignment, Memory > &&other)
 
template<typename U >
 AlignedAllocator (AlignedAllocator< U, Alignment, Memory > &&other)
 
 ~AlignedAllocator ()
 
pointer allocate (size_type n, const void *=nullptr)
 
void deallocate (pointer ptr, size_type)
 
AlignedAllocator< T, Alignment, Memory > & operator= (const AlignedAllocator< T, Alignment, Memory > &)=default
 
AlignedAllocator< T, Alignment, Memory > & operator= (AlignedAllocator< T, Alignment, Memory > &&)=default
 

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 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 267 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 >::pointer = typename std::allocator<T>::pointer

Definition at line 271 of file aligned_memory.hpp.

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

Definition at line 270 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 ( )
inline

Definition at line 280 of file aligned_memory.hpp.

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

Definition at line 282 of file aligned_memory.hpp.

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 289 of file aligned_memory.hpp.

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

Definition at line 298 of file aligned_memory.hpp.

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

Definition at line 305 of file aligned_memory.hpp.

template<typename T, std::size_t Alignment = 32, typename Memory = AlignedMemory>
vsmc::AlignedAllocator< T, Alignment, Memory >::~AlignedAllocator ( )
inline

Definition at line 314 of file aligned_memory.hpp.

Member Function Documentation

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

Definition at line 316 of file aligned_memory.hpp.

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

Definition at line 325 of file aligned_memory.hpp.

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