DPC++ Runtime
Runtime libraries for oneAPI DPC++
|
|
Go to the documentation of this file.
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>> {
89 using pointer =
typename allocator_type::pointer;
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
void construct(pointer Ptr, const_reference Val)
static pointer allocate(allocator_type &Allocator, size_type NumElems)
typename std::pointer_traits< pointer >::template rebind< void > void_pointer
static void construct(allocator_type &Allocator, U *Ptr, ArgsT &&...Args)
typename allocator_type::value_type value_type
~aligned_allocator()=default
static void destroy(allocator_type &Allocator, U *Ptr)
---— Error handling, matching OpenCL plugin semantics.
std::false_type propagate_on_container_move_assignment
simd< _Tp, _Abi > max(const simd< _Tp, _Abi > &, const simd< _Tp, _Abi > &) noexcept
std::make_unsigned_t< difference_type > size_type
typename std::pointer_traits< pointer >::template rebind< const void > const_void_pointer
typename sycl::detail::aligned_allocator< T >::template rebind< U >::other rebind_alloc
void setAlignment(size_t Alignment)
static size_type max_size(const allocator_type &) noexcept
bool operator!=(const aligned_allocator &)
static void * alignedAlloc(size_t Alignment, size_t NumBytes)
Allocates NumBytes bytes of uninitialized storage whose alignment is specified by Alignment.
void deallocate(pointer Ptr, size_t)
static void deallocate(allocator_type &Allocator, pointer Ptr, size_type NumElems)
aligned_allocator(size_t Alignment)
const_pointer address(const_reference Val)
typename std::pointer_traits< pointer >::difference_type difference_type
const T & const_reference
typename allocator_type::const_pointer const_pointer
pointer allocate(size_t Size)
aligned_allocator< U > other
std::ptrdiff_t difference_type
typename allocator_type::pointer pointer
aligned_allocator()=default
void destroy(pointer Ptr)
pointer address(reference Val) const
static allocator_type select_on_container_copy_construction(const allocator_type &Allocator)
static pointer allocate(allocator_type &Allocator, size_type NumElems, const_void_pointer)
std::false_type propagate_on_container_copy_assignment
typename sycl::detail::aligned_allocator< T > allocator_type
allocator_traits< rebind_alloc< U > > rebind_traits
bool operator==(const aligned_allocator &)
typename std::is_empty< allocator_type >::type is_always_equal
static void alignedFree(void *Ptr)
Deallocates the memory referenced by Ptr.
std::false_type propagate_on_container_swap