cds  2.3.2
cds::details::Allocator< T, Alloc > Class Template Reference

Extends std::allocator interface to provide semantics like operator new and delete. More...

#include <cds/details/allocator.h>

Inheritance diagram for cds::details::Allocator< T, Alloc >:

Data Structures

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

Public Types

typedef std::conditional< std::is_same< T, typename Alloc::value_type >::value, Alloc, typename Alloc::template rebind< T >::other >::type allocator_type
 Underlying allocator type.
 
typedef T value_type
 Element type.
 

Public Member Functions

template<typename... S>
value_typeNew (S const &... src)
 Analogue of operator new T(src... )
 
template<typename... Args>
value_typeMoveNew (Args &&... args)
 Analogue of operator new T( std::forward<Args>(args)... ) (move semantics)
 
value_typeNewArray (size_t nCount)
 Analogue of operator new T[nCount ].
 
template<typename S >
value_typeNewArray (size_t nCount, S const &src)
 Analogue of operator new T[nCount ]. More...
 
template<typename... S>
value_typeNewBlock (size_t nSize, S const &... src)
 Allocates block of memory of size at least nSize bytes. More...
 
void Delete (value_type *p)
 Analogue of operator delete.
 
void Delete (value_type *p, size_t nCount)
 Analogue of operator delete [].
 
template<typename... S>
value_typeConstruct (void *p, S const &... src)
 Analogue of placement operator new( p ) T( src... )
 
template<typename... Args>
value_typeMoveConstruct (void *p, Args &&... args)
 Analogue of placement operator new( p ) T( std::forward<Args>(args)... )
 

Static Public Attributes

static constexpr bool const c_bStdAllocator = std::is_same< allocator_type, std::allocator<T>>::value
 true if underlined allocator is std::allocator, false otherwise
 

Detailed Description

template<typename T, class Alloc = CDS_DEFAULT_ALLOCATOR>
class cds::details::Allocator< T, Alloc >

Extends std::allocator interface to provide semantics like operator new and delete.

The class is the wrapper around underlying Alloc class. Alloc provides the std::allocator interface.

Member Function Documentation

◆ NewArray()

template<typename T , class Alloc = CDS_DEFAULT_ALLOCATOR>
template<typename S >
value_type* cds::details::Allocator< T, Alloc >::NewArray ( size_t  nCount,
S const &  src 
)
inline

Analogue of operator new T[nCount ].

Each item of array of type T is initialized by parameter src: T( src )

◆ NewBlock()

template<typename T , class Alloc = CDS_DEFAULT_ALLOCATOR>
template<typename... S>
value_type* cds::details::Allocator< T, Alloc >::NewBlock ( size_t  nSize,
S const &...  src 
)
inline

Allocates block of memory of size at least nSize bytes.

Internally, the block is allocated as an array of void* pointers, then Construct() method is called to initialize T.

Precondition: nSize >= sizeof(T)


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