1 #ifndef DASH__ALLOCATOR__ALLOCATOR_TRAITS_H__INCLUDED 2 #define DASH__ALLOCATOR__ALLOCATOR_TRAITS_H__INCLUDED 5 #include <dash/memory/MemorySpace.h> 13 DASH__META__DEFINE_TRAIT__HAS_TYPE(local_pointer)
15 template <class _Alloc, bool = has_type_local_pointer<_Alloc>::value>
16 struct allocator_traits_local_pointer {
17 typedef typename _Alloc::local_pointer type;
20 template <
class _Alloc>
21 struct allocator_traits_local_pointer<_Alloc, false> {
22 typedef typename std::allocator_traits<
23 typename _Alloc::local_allocator_type>::pointer type;
26 DASH__META__DEFINE_TRAIT__HAS_TYPE(const_local_pointer)
28 template <class _Alloc, bool = has_type_const_local_pointer<_Alloc>::value>
29 struct allocator_traits_const_local_pointer {
30 typedef typename _Alloc::const_local_pointer type;
33 template <
class _Alloc>
34 struct allocator_traits_const_local_pointer<_Alloc, false> {
35 typedef typename std::allocator_traits<
36 typename _Alloc::local_allocator_type>::const_pointer type;
39 DASH__META__DEFINE_TRAIT__HAS_TYPE(local_void_pointer)
41 template <class _Alloc, bool = has_type_local_void_pointer<_Alloc>::value>
42 struct allocator_traits_local_void_pointer {
43 typedef typename _Alloc::local_void_pointer type;
46 template <
class _Alloc>
47 struct allocator_traits_local_void_pointer<_Alloc, false> {
48 typedef typename std::allocator_traits<
49 typename _Alloc::local_allocator_type>::void_pointer type;
52 DASH__META__DEFINE_TRAIT__HAS_TYPE(const_local_void_pointer)
56 bool = has_type_const_local_void_pointer<_Alloc>::value>
57 struct allocator_traits_const_local_void_pointer {
58 typedef typename _Alloc::const_local_void_pointer type;
61 template <
class _Alloc>
62 struct allocator_traits_const_local_void_pointer<_Alloc, false> {
63 typedef typename std::allocator_traits<
64 typename _Alloc::local_allocator_type>::const_void_pointer type;
67 DASH__META__DEFINE_TRAIT__HAS_TYPE(pointer)
69 template <class _Alloc, bool = has_type_pointer<_Alloc>::value>
70 struct allocator_traits_pointer {
71 typedef typename _Alloc::pointer type;
74 template <
class _Alloc>
75 struct allocator_traits_pointer<_Alloc, false> {
79 DASH__META__DEFINE_TRAIT__HAS_TYPE(const_pointer)
81 template <class _Alloc, bool = has_type_const_pointer<_Alloc>::value>
82 struct allocator_traits_const_pointer {
83 typedef typename _Alloc::const_pointer type;
86 template <
class _Alloc>
87 struct allocator_traits_const_pointer<_Alloc, false> {
91 DASH__META__DEFINE_TRAIT__HAS_TYPE(void_pointer)
93 template <class _Alloc, bool = has_type_void_pointer<_Alloc>::value>
94 struct allocator_traits_void_pointer {
95 typedef typename _Alloc::void_pointer type;
98 template <
class _Alloc>
99 struct allocator_traits_void_pointer<_Alloc, false> {
103 DASH__META__DEFINE_TRAIT__HAS_TYPE(const_void_pointer)
105 template <class _Alloc, bool = has_type_const_void_pointer<_Alloc>::value>
106 struct allocator_traits_const_void_pointer {
107 typedef typename _Alloc::const_void_pointer type;
110 template <
class _Alloc>
111 struct allocator_traits_const_void_pointer<_Alloc, false> {
115 DASH__META__DEFINE_TRAIT__HAS_TYPE(difference_type)
117 template <class _Alloc, bool = has_type_difference_type<_Alloc>::value>
118 struct allocator_traits_difference_type {
119 typedef typename _Alloc::difference_type type;
122 template <
class _Alloc>
123 struct allocator_traits_difference_type<_Alloc, false> {
127 DASH__META__DEFINE_TRAIT__HAS_TYPE(size_type)
129 template <class _Alloc, bool = has_type_size_type<_Alloc>::value>
130 struct allocator_traits_size_type {
131 typedef typename _Alloc::size_type type;
134 template <
class _Alloc>
135 struct allocator_traits_size_type<_Alloc, false> {
140 template <
class Alloc>
143 typedef Alloc allocator_type;
144 typedef typename Alloc::value_type value_type;
146 typedef typename Alloc::allocation_policy allocation_policy;
148 typedef typename Alloc::local_allocator_type local_allocator;
151 typedef typename detail::allocator_traits_difference_type<Alloc>::type
153 typedef typename detail::allocator_traits_size_type<Alloc>::type size_type;
156 typedef typename detail::allocator_traits_pointer<Alloc>::type pointer;
157 typedef typename detail::allocator_traits_const_pointer<Alloc>::type
159 typedef typename detail::allocator_traits_void_pointer<Alloc>::type
161 typedef typename detail::allocator_traits_const_void_pointer<Alloc>::type
165 typedef typename detail::allocator_traits_local_pointer<Alloc>::type
167 typedef typename detail::allocator_traits_const_local_pointer<Alloc>::type
169 typedef typename detail::allocator_traits_local_void_pointer<Alloc>::type
172 typename detail::allocator_traits_const_local_void_pointer<Alloc>::type
173 const_local_void_pointer;
176 using rebind_alloc =
typename allocator_type::template rebind<U>;
181 static pointer allocate(allocator_type& a, size_type n)
183 return a.allocate(n);
186 static void deallocate(allocator_type& a, pointer p, size_type n)
194 #endif // DASH__ALLOCATOR__ALLOCATOR_TRAITS_H__INCLUDED internal::default_signed_index gptrdiff_t
Difference type for global pointers.
internal::default_unsigned_index default_size_t
Unsigned integer type used as default for size values.
This class is a simple memory pool which holds allocates elements of size ValueType.
DART Global pointer type.