cds  2.3.2
cds::details::AlignedAllocator< T, ALIGNED_ALLOCATOR > Class Template Reference

Allocator for aligned data. More...

#include <cds/details/aligned_allocator.h>

Inheritance diagram for cds::details::AlignedAllocator< T, ALIGNED_ALLOCATOR >:

Data Structures

struct  rebind
 Rebinds allocator to other type Q instead of T. More...
 

Public Types

typedef ALIGNED_ALLOCATOR::template rebind< T >::other allocator_type
 Underlying aligned allocator type.
 

Public Member Functions

template<typename... S>
T * New (size_t nAlign, const S &... src)
 Analogue of operator new T(src... )
 
T * NewArray (size_t nAlign, size_t nCount)
 Analogue of operator new T[nCount ].
 
template<typename S >
T * NewArray (size_t nAlign, size_t nCount, const S &src)
 Analogue of operator new T[nCount ]. More...
 
void Delete (T *p)
 Analogue of operator delete.
 
void Delete (T *p, size_t nCount)
 Analogue of operator delete [].
 
template<typename... S>
T * Construct (void *p, const S &... src)
 Analogue of placement operator new( p ) T( src... )
 

Detailed Description

template<typename T, typename ALIGNED_ALLOCATOR = CDS_DEFAULT_ALIGNED_ALLOCATOR>
class cds::details::AlignedAllocator< T, ALIGNED_ALLOCATOR >

Allocator for aligned data.

The class is the wrapper around user-defined aligned allocator. Template parameters:

  • T is a type to allocate
  • ALIGNED_ALLOCATOR is an aligned allocator implementation. Default implementation is defined by macro CDS_DEFAULT_ALIGNED_ALLOCATOR from cds/user_setup/allocator.h header file.

The nAlign parameter of member function specifyes desired aligment of data allocated.

Note
When an array allocation is performed the allocator guarantees the alignment for first element of array only. To guarantee the alignment for each element of the array the size of type T must be multiple of nAlign:
sizeof(T) % nAlign == 0

Member Function Documentation

◆ NewArray()

template<typename T , typename ALIGNED_ALLOCATOR = CDS_DEFAULT_ALIGNED_ALLOCATOR>
template<typename S >
T* cds::details::AlignedAllocator< T, ALIGNED_ALLOCATOR >::NewArray ( size_t  nAlign,
size_t  nCount,
const S &  src 
)
inline

Analogue of operator new T[nCount ].

Each item of array of type T is initialized by parameter src.


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

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:35 by Doxygen 1.8.13