Blaze 3.9
DynamicAllocator.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_TYPETRAITS_DYNAMICALLOCATOR_H_
36#define _BLAZE_MATH_TYPETRAITS_DYNAMICALLOCATOR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <memory>
46
47
48namespace blaze {
49
50//=================================================================================================
51//
52// CLASS DEFINITION
53//
54//=================================================================================================
55
56//*************************************************************************************************
93template< typename A1, typename... As >
95{
96 public:
97 //**********************************************************************************************
99 template< typename U >
100 using Type = NullAllocator<U>;
102 //**********************************************************************************************
103};
104//*************************************************************************************************
105
106
107//*************************************************************************************************
112template< typename T >
114{
115 template< typename U >
116 using Type = AlignedAllocator<U>;
117};
119//*************************************************************************************************
120
121
122//*************************************************************************************************
127template< typename T >
128struct DynamicAllocator< NullAllocator<T> >
129{
130 template< typename U >
131 using Type = AlignedAllocator<U>;
132};
134//*************************************************************************************************
135
136
137//*************************************************************************************************
142template< typename T1, typename T2 >
143struct DynamicAllocator< AlignedAllocator<T1>, AlignedAllocator<T2> >
144{
145 template< typename U >
146 using Type = AlignedAllocator<U>;
147};
149//*************************************************************************************************
150
151
152//*************************************************************************************************
157template< typename A1, typename T2 >
158struct DynamicAllocator< A1, NullAllocator<T2> >
159{
160 template< typename U >
161 using Type = typename std::allocator_traits<A1>::template rebind_alloc<U>;
162};
164//*************************************************************************************************
165
166
167//*************************************************************************************************
172template< typename A2, typename T1 >
173struct DynamicAllocator< NullAllocator<T1>, A2 >
174{
175 template< typename U >
176 using Type = typename std::allocator_traits<A2>::template rebind_alloc<U>;
177};
179//*************************************************************************************************
180
181
182//*************************************************************************************************
187template< typename T1, typename T2 >
188struct DynamicAllocator< NullAllocator<T1>, NullAllocator<T2> >
189{
190 template< typename U >
191 using Type = AlignedAllocator<U>;
192};
194//*************************************************************************************************
195
196
197//*************************************************************************************************
210template< typename T, typename... As >
211using DynamicAllocator_t = typename DynamicAllocator<As...>::template Type<T>;
212//*************************************************************************************************
213
214} // namespace blaze
215
216#endif
Header file for the AlignedAllocator implementation.
Header file for the NullAllocator implementation.
Allocator for type-specific aligned memory.
Definition: AlignedAllocator.h:72
Allocator returning nullptr.
Definition: NullAllocator.h:66
typename DynamicAllocator< As... >::template Type< T > DynamicAllocator_t
Auxiliary alias declaration for the DynamicAllocator type trait.
Definition: DynamicAllocator.h:211
Deduction of an allocator type for dynamic vectors and matrices.
Definition: DynamicAllocator.h:95