sparrow 1.4.0
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Loading...
Searching...
No Matches
xsimd::aligned_allocator< T, Align > Class Template Reference

Allocator for aligned memory. More...

#include <xsimd_aligned_allocator.hpp>

Collaboration diagram for xsimd::aligned_allocator< T, Align >:
[legend]

Classes

struct  rebind
 

Public Types

using value_type = T
 
using pointer = T*
 
using const_pointer = const T*
 
using reference = T&
 
using const_reference = const T&
 
using size_type = size_t
 
using difference_type = ptrdiff_t
 

Public Member Functions

XSIMD_INLINE aligned_allocator () noexcept
 Default constructor.
 
XSIMD_INLINE aligned_allocator (const aligned_allocator &rhs) noexcept
 Copy constructor.
 
template<class U>
XSIMD_INLINE aligned_allocator (const aligned_allocator< U, Align > &rhs) noexcept
 
XSIMD_INLINE ~aligned_allocator ()
 Destructor.
 
XSIMD_INLINE pointer address (reference) noexcept
 Returns the actual address of r even in presence of overloaded operator&.
 
XSIMD_INLINE const_pointer address (const_reference) const noexcept
 Returns the actual address of r even in presence of overloaded operator&.
 
XSIMD_INLINE pointer allocate (size_type n, const void *hint=0)
 Allocates n * sizeof(T) bytes of uninitialized memory, aligned by A.
 
XSIMD_INLINE void deallocate (pointer p, size_type n)
 Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier call to allocate().
 
XSIMD_INLINE size_type max_size () const noexcept
 Returns the maximum theoretically possible value of n, for which the call allocate(n, 0) could succeed.
 
XSIMD_INLINE size_type size_max () const noexcept
 This method is deprecated, use max_size() instead.
 
template<class U, class... Args>
XSIMD_INLINE void construct (U *p, Args &&... args)
 Constructs an object of type T in allocated uninitialized memory pointed to by p, using placement-new.
 
template<class U>
XSIMD_INLINE void destroy (U *p)
 Calls the destructor of the object pointed to by p.
 
template<class U>
XSIMD_INLINE aligned_allocator (const aligned_allocator< U, A > &) noexcept
 Extended copy constructor.
 

Static Public Attributes

static constexpr size_t alignment = Align
 

Detailed Description

template<class T, size_t Align = 64>
class xsimd::aligned_allocator< T, Align >

Allocator for aligned memory.

The aligned_allocator class template is an allocator that performs memory allocation aligned by the specified value.

Template Parameters
Ttype of objects to allocate.
Alignalignment in bytes.

Definition at line 49 of file xsimd_aligned_allocator.hpp.

Member Typedef Documentation

◆ const_pointer

template<class T, size_t Align = 64>
using xsimd::aligned_allocator< T, Align >::const_pointer = const T*

Definition at line 54 of file xsimd_aligned_allocator.hpp.

◆ const_reference

template<class T, size_t Align = 64>
using xsimd::aligned_allocator< T, Align >::const_reference = const T&

Definition at line 56 of file xsimd_aligned_allocator.hpp.

◆ difference_type

template<class T, size_t Align = 64>
using xsimd::aligned_allocator< T, Align >::difference_type = ptrdiff_t

Definition at line 58 of file xsimd_aligned_allocator.hpp.

◆ pointer

template<class T, size_t Align = 64>
using xsimd::aligned_allocator< T, Align >::pointer = T*

Definition at line 53 of file xsimd_aligned_allocator.hpp.

◆ reference

template<class T, size_t Align = 64>
using xsimd::aligned_allocator< T, Align >::reference = T&

Definition at line 55 of file xsimd_aligned_allocator.hpp.

◆ size_type

template<class T, size_t Align = 64>
using xsimd::aligned_allocator< T, Align >::size_type = size_t

Definition at line 57 of file xsimd_aligned_allocator.hpp.

◆ value_type

template<class T, size_t Align = 64>
using xsimd::aligned_allocator< T, Align >::value_type = T

Definition at line 52 of file xsimd_aligned_allocator.hpp.

Constructor & Destructor Documentation

◆ aligned_allocator() [1/4]

template<class T, size_t A>
XSIMD_INLINE xsimd::aligned_allocator< T, A >::aligned_allocator ( )
noexcept

Default constructor.

Definition at line 114 of file xsimd_aligned_allocator.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ aligned_allocator() [2/4]

template<class T, size_t A>
XSIMD_INLINE xsimd::aligned_allocator< T, A >::aligned_allocator ( const aligned_allocator< T, Align > & rhs)
noexcept

Copy constructor.

Definition at line 122 of file xsimd_aligned_allocator.hpp.

Here is the call graph for this function:

◆ aligned_allocator() [3/4]

template<class T, size_t Align = 64>
template<class U>
XSIMD_INLINE xsimd::aligned_allocator< T, Align >::aligned_allocator ( const aligned_allocator< U, Align > & rhs)
noexcept

◆ ~aligned_allocator()

template<class T, size_t A>
XSIMD_INLINE xsimd::aligned_allocator< T, A >::~aligned_allocator ( )

Destructor.

Definition at line 139 of file xsimd_aligned_allocator.hpp.

◆ aligned_allocator() [4/4]

template<class T, size_t Align = 64>
template<class U>
XSIMD_INLINE xsimd::aligned_allocator< T, Align >::aligned_allocator ( const aligned_allocator< U, A > & )
noexcept

Extended copy constructor.

Definition at line 131 of file xsimd_aligned_allocator.hpp.

Member Function Documentation

◆ address() [1/2]

template<class T, size_t A>
XSIMD_INLINE auto xsimd::aligned_allocator< T, A >::address ( const_reference r) const
noexcept

Returns the actual address of r even in presence of overloaded operator&.

Parameters
rthe object to acquire address of.
Returns
the actual address of r.

Definition at line 162 of file xsimd_aligned_allocator.hpp.

◆ address() [2/2]

template<class T, size_t A>
XSIMD_INLINE auto xsimd::aligned_allocator< T, A >::address ( reference r)
noexcept

Returns the actual address of r even in presence of overloaded operator&.

Parameters
rthe object to acquire address of.
Returns
the actual address of r.

Definition at line 150 of file xsimd_aligned_allocator.hpp.

◆ allocate()

template<class T, size_t A>
XSIMD_INLINE auto xsimd::aligned_allocator< T, A >::allocate ( size_type n,
const void * hint = 0 )

Allocates n * sizeof(T) bytes of uninitialized memory, aligned by A.

The alignment may require some extra memory allocation.

Parameters
nthe number of objects to allocate storage for.
hintunused parameter provided for standard compliance.
Returns
a pointer to the first byte of a memory block suitably aligned and sufficient to hold an array of n objects of type T.

Definition at line 177 of file xsimd_aligned_allocator.hpp.

Here is the call graph for this function:

◆ construct()

template<class T, size_t A>
template<class U, class... Args>
XSIMD_INLINE void xsimd::aligned_allocator< T, A >::construct ( U * p,
Args &&... args )

Constructs an object of type T in allocated uninitialized memory pointed to by p, using placement-new.

Parameters
ppointer to allocated uninitialized memory.
argsthe constructor arguments to use.

Definition at line 230 of file xsimd_aligned_allocator.hpp.

◆ deallocate()

template<class T, size_t A>
XSIMD_INLINE void xsimd::aligned_allocator< T, A >::deallocate ( pointer p,
size_type n )

Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier call to allocate().

The argument n must be equal to the first argument of the call to allocate() that originally produced p; otherwise, the behavior is undefined.

Parameters
ppointer obtained from allocate().
nnumber of objects earlier passed to allocate().

Definition at line 195 of file xsimd_aligned_allocator.hpp.

Here is the call graph for this function:

◆ destroy()

template<class T, size_t A>
template<class U>
XSIMD_INLINE void xsimd::aligned_allocator< T, A >::destroy ( U * p)

Calls the destructor of the object pointed to by p.

Parameters
ppointer to the object that is going to be destroyed.

Definition at line 241 of file xsimd_aligned_allocator.hpp.

◆ max_size()

template<class T, size_t A>
XSIMD_INLINE auto xsimd::aligned_allocator< T, A >::max_size ( ) const
noexcept

Returns the maximum theoretically possible value of n, for which the call allocate(n, 0) could succeed.

Returns
the maximum supported allocated size.

Definition at line 207 of file xsimd_aligned_allocator.hpp.

◆ size_max()

template<class T, size_t A>
XSIMD_INLINE auto xsimd::aligned_allocator< T, A >::size_max ( ) const
noexcept

This method is deprecated, use max_size() instead.

Definition at line 217 of file xsimd_aligned_allocator.hpp.

Member Data Documentation

◆ alignment

template<class T, size_t Align = 64>
size_t xsimd::aligned_allocator< T, Align >::alignment = Align
staticconstexpr

Definition at line 60 of file xsimd_aligned_allocator.hpp.


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