17 #include <type_traits>
20 inline namespace _V1 {
31 template <
typename U>
struct rebind {
54 NumBytes = ((NumBytes - 1) | (MAlignment - 1)) + 1;
56 throw std::bad_alloc();
61 throw std::bad_alloc();
78 size_t MAlignment = 128;
86 struct allocator_traits<
sycl::detail::aligned_allocator<T>> {
92 typename std::pointer_traits<pointer>::template rebind<void>;
94 typename std::pointer_traits<pointer>::template rebind<const void>;
97 using size_type = std::make_unsigned_t<difference_type>;
103 template <
typename U>
105 typename sycl::detail::aligned_allocator<T>::template rebind<U>::other;
106 template <
typename U>
using rebind_traits = allocator_traits<rebind_alloc<U>>;
109 return Allocator.allocate(NumElems);
115 return Allocator.allocate(NumElems);
120 Allocator.deallocate(Ptr, NumElems);
123 template <
class U,
class... ArgsT>
125 return Allocator.construct(Ptr, Args...);
129 Allocator.destroy(Ptr);
137 static allocator_type
static void * alignedAlloc(size_t Alignment, size_t NumBytes)
Allocates NumBytes bytes of uninitialized storage whose alignment is specified by Alignment.
static void alignedFree(void *Ptr)
Deallocates the memory referenced by Ptr.
aligned_allocator()=default
aligned_allocator(size_t Alignment)
void destroy(pointer Ptr)
void setAlignment(size_t Alignment)
pointer address(reference Val) const
void construct(pointer Ptr, const_reference Val)
~aligned_allocator()=default
bool operator!=(const aligned_allocator &)
bool operator==(const aligned_allocator &)
const T & const_reference
void deallocate(pointer Ptr, size_t)
const_pointer address(const_reference Val)
pointer allocate(size_t Size)
std::ptrdiff_t difference_type
std::conditional_t< is_decorated, decorated_type *, std::add_pointer_t< value_type > > pointer
_Abi const simd< _Tp, _Abi > & noexcept
typename std::is_empty< allocator_type >::type is_always_equal
static pointer allocate(allocator_type &Allocator, size_type NumElems, const_void_pointer)
typename allocator_type::const_pointer const_pointer
static void construct(allocator_type &Allocator, U *Ptr, ArgsT &&...Args)
std::false_type propagate_on_container_move_assignment
typename allocator_type::value_type value_type
allocator_traits< rebind_alloc< U > > rebind_traits
std::false_type propagate_on_container_swap
std::false_type propagate_on_container_copy_assignment
static allocator_type select_on_container_copy_construction(const allocator_type &Allocator)
typename std::pointer_traits< pointer >::template rebind< const void > const_void_pointer
static pointer allocate(allocator_type &Allocator, size_type NumElems)
typename sycl::detail::aligned_allocator< T >::template rebind< U >::other rebind_alloc
std::make_unsigned_t< difference_type > size_type
static void deallocate(allocator_type &Allocator, pointer Ptr, size_type NumElems)
typename std::pointer_traits< pointer >::difference_type difference_type
static void destroy(allocator_type &Allocator, U *Ptr)
typename allocator_type::pointer pointer
typename sycl::detail::aligned_allocator< T > allocator_type
static size_type max_size(const allocator_type &) noexcept
typename std::pointer_traits< pointer >::template rebind< void > void_pointer
aligned_allocator< U > other