@@ -48,7 +48,7 @@ namespace xt
48
48
using default_allocator_for_ptr_t = typename default_allocator_for_ptr<P>::type;
49
49
50
50
template <class T >
51
- using not_an_array = xtl::negation<is_array <T>>;
51
+ using has_dynamic_size = xtl::negation<has_fixed_size <T>>;
52
52
53
53
template <class T >
54
54
using not_a_pointer = xtl::negation<std::is_pointer<T>>;
@@ -71,8 +71,8 @@ namespace xt
71
71
* @param l the layout_type of the xarray_adaptor
72
72
*/
73
73
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class C , class SC ,
74
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>,
75
- detail::not_a_pointer<C >)>
74
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>,
75
+ detail::not_a_pointer<std:: remove_reference_t <C> >)>
76
76
inline xarray_adaptor<xtl::closure_type_t<C>, L, std::decay_t<SC>>
77
77
adapt(C&& container, const SC& shape, layout_type l = L)
78
78
{
@@ -88,7 +88,7 @@ namespace xt
88
88
* @param l the layout_type of the xarray_adaptor
89
89
*/
90
90
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class C , class SC ,
91
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>,
91
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>,
92
92
std::is_pointer<std::remove_reference_t <C>>)>
93
93
inline auto adapt(C&& pointer, const SC& shape, layout_type l = L)
94
94
{
@@ -107,7 +107,7 @@ namespace xt
107
107
* @param strides the strides of the xarray_adaptor
108
108
*/
109
109
template <class C , class SC , class SS ,
110
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>,
110
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>,
111
111
detail::not_a_layout<std::decay_t <SS>>)>
112
112
inline xarray_adaptor<xtl::closure_type_t<C>, layout_type::dynamic, std::decay_t<SC>>
113
113
adapt(C&& container, SC&& shape, SS&& strides)
@@ -131,7 +131,7 @@ namespace xt
131
131
* @param alloc the allocator used for allocating / deallocating the dynamic array
132
132
*/
133
133
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class P , class O , class SC , class A = detail::default_allocator_for_ptr_t <P>,
134
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>)>
134
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>)>
135
135
inline xarray_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, L, SC>
136
136
adapt(P&& pointer, typename A::size_type size, O ownership, const SC& shape, layout_type l = L, const A& alloc = A())
137
137
{
@@ -155,7 +155,7 @@ namespace xt
155
155
* @param alloc the allocator used for allocating / deallocating the dynamic array
156
156
*/
157
157
template <class P , class O , class SC , class SS , class A = detail::default_allocator_for_ptr_t <P>,
158
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>,
158
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>,
159
159
detail::not_a_layout<std::decay_t <SS>>)>
160
160
inline xarray_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, layout_type::dynamic, std::decay_t<SC>>
161
161
adapt(P&& pointer, typename A::size_type size, O ownership, SC&& shape, SS&& strides, const A& alloc = A())
@@ -178,7 +178,7 @@ namespace xt
178
178
* @param l the layout_type of the xarray_adaptor
179
179
*/
180
180
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class T , std::size_t N, class SC ,
181
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>)>
181
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>)>
182
182
inline auto adapt(T (&c_array)[N], const SC& shape, layout_type l = L)
183
183
{
184
184
return adapt (&c_array[0 ], N, xt::no_ownership (), shape, l);
@@ -192,7 +192,7 @@ namespace xt
192
192
* @param strides the strides of the xarray_adaptor
193
193
*/
194
194
template <class T , std::size_t N, class SC , class SS ,
195
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>,
195
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>,
196
196
detail::not_a_layout<std::decay_t <SS>>)>
197
197
inline auto adapt(T (&c_array)[N], SC&& shape, SS&& strides)
198
198
{
@@ -228,13 +228,13 @@ namespace xt
228
228
* @param l the layout_type of the xtensor_adaptor
229
229
*/
230
230
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class C , class SC ,
231
- XTL_REQUIRES (detail::is_array <std::decay_t <SC>>,
232
- detail::not_a_pointer<C >)>
233
- inline xtensor_adaptor<C, detail::array_size<SC >::value, L>
231
+ XTL_REQUIRES (detail::has_fixed_size <std::decay_t <SC>>,
232
+ detail::not_a_pointer<std:: remove_reference_t <C> >)>
233
+ inline xtensor_adaptor<C, detail::get_fixed_size<std::decay_t<SC> >::value, L>
234
234
adapt(C&& container, const SC& shape, layout_type l = L)
235
235
{
236
236
static_assert (!xtl::is_integral<SC>::value, " shape cannot be a integer" );
237
- constexpr std::size_t N = detail::array_size<SC >::value;
237
+ constexpr std::size_t N = detail::get_fixed_size<std:: decay_t <SC> >::value;
238
238
using return_type = xtensor_adaptor<xtl::closure_type_t <C>, N, L>;
239
239
return return_type (std::forward<C>(container), shape, l);
240
240
}
@@ -246,13 +246,13 @@ namespace xt
246
246
* @param l the layout_type of the xtensor_adaptor
247
247
*/
248
248
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class C , class SC ,
249
- XTL_REQUIRES (detail::is_array <std::decay_t <SC>>,
249
+ XTL_REQUIRES (detail::has_fixed_size <std::decay_t <SC>>,
250
250
std::is_pointer<std::remove_reference_t <C>>)>
251
251
inline auto adapt(C&& pointer, const SC& shape, layout_type l = L)
252
252
{
253
253
static_assert (!xtl::is_integral<SC>::value, " shape cannot be a integer" );
254
254
using buffer_type = xbuffer_adaptor<C, xt::no_ownership, detail::default_allocator_for_ptr_t <C>>;
255
- constexpr std::size_t N = detail::array_size<SC >::value;
255
+ constexpr std::size_t N = detail::get_fixed_size<std:: decay_t <SC> >::value;
256
256
using return_type = xtensor_adaptor<buffer_type, N, L>;
257
257
return return_type (buffer_type (pointer, compute_size (shape)), shape, l);
258
258
}
@@ -265,13 +265,13 @@ namespace xt
265
265
* @param strides the strides of the xtensor_adaptor
266
266
*/
267
267
template <class C , class SC , class SS ,
268
- XTL_REQUIRES (detail::is_array <std::decay_t <SC>>,
268
+ XTL_REQUIRES (detail::has_fixed_size <std::decay_t <SC>>,
269
269
detail::not_a_layout<std::decay_t <SS>>)>
270
- inline xtensor_adaptor<C, detail::array_size<SC >::value, layout_type::dynamic>
270
+ inline xtensor_adaptor<C, detail::get_fixed_size<std::decay_t<SC> >::value, layout_type::dynamic>
271
271
adapt(C&& container, SC&& shape, SS&& strides)
272
272
{
273
273
static_assert (!xtl::is_integral<std::decay_t <SC>>::value, " shape cannot be a integer" );
274
- constexpr std::size_t N = detail::array_size<SC >::value;
274
+ constexpr std::size_t N = detail::get_fixed_size<std:: decay_t <SC> >::value;
275
275
using return_type = xtensor_adaptor<xtl::closure_type_t <C>, N, layout_type::dynamic>;
276
276
return return_type (std::forward<C>(container),
277
277
xtl::forward_sequence<typename return_type::inner_shape_type, SC>(shape),
@@ -312,14 +312,14 @@ namespace xt
312
312
* @param alloc the allocator used for allocating / deallocating the dynamic array
313
313
*/
314
314
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class P , class O , class SC , class A = detail::default_allocator_for_ptr_t <P>,
315
- XTL_REQUIRES (detail::is_array <std::decay_t <SC>>)>
316
- inline xtensor_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, detail::array_size<SC >::value, L>
315
+ XTL_REQUIRES (detail::has_fixed_size <std::decay_t <SC>>)>
316
+ inline xtensor_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, detail::get_fixed_size<std::decay_t<SC> >::value, L>
317
317
adapt(P&& pointer, typename A::size_type size, O ownership, const SC& shape, layout_type l = L, const A& alloc = A())
318
318
{
319
319
static_assert (!xtl::is_integral<SC>::value, " shape cannot be a integer" );
320
320
(void )ownership;
321
321
using buffer_type = xbuffer_adaptor<xtl::closure_type_t <P>, O, A>;
322
- constexpr std::size_t N = detail::array_size<SC >::value;
322
+ constexpr std::size_t N = detail::get_fixed_size<std:: decay_t <SC> >::value;
323
323
using return_type = xtensor_adaptor<buffer_type, N, L>;
324
324
buffer_type buf (std::forward<P>(pointer), size, alloc);
325
325
return return_type (std::move (buf), shape, l);
@@ -337,15 +337,15 @@ namespace xt
337
337
* @param alloc the allocator used for allocating / deallocating the dynamic array
338
338
*/
339
339
template <class P , class O , class SC , class SS , class A = detail::default_allocator_for_ptr_t <P>,
340
- XTL_REQUIRES (detail::is_array <std::decay_t <SC>>,
340
+ XTL_REQUIRES (detail::has_fixed_size <std::decay_t <SC>>,
341
341
detail::not_a_layout<std::decay_t <SS>>)>
342
- inline xtensor_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, detail::array_size<SC >::value, layout_type::dynamic>
342
+ inline xtensor_adaptor<xbuffer_adaptor<xtl::closure_type_t<P>, O, A>, detail::get_fixed_size<std::decay_t<SC> >::value, layout_type::dynamic>
343
343
adapt(P&& pointer, typename A::size_type size, O ownership, SC&& shape, SS&& strides, const A& alloc = A())
344
344
{
345
345
static_assert (!xtl::is_integral<std::decay_t <SC>>::value, " shape cannot be a integer" );
346
346
(void )ownership;
347
347
using buffer_type = xbuffer_adaptor<xtl::closure_type_t <P>, O, A>;
348
- constexpr std::size_t N = detail::array_size<SC >::value;
348
+ constexpr std::size_t N = detail::get_fixed_size<std:: decay_t <SC> >::value;
349
349
using return_type = xtensor_adaptor<buffer_type, N, layout_type::dynamic>;
350
350
buffer_type buf (std::forward<P>(pointer), size, alloc);
351
351
return return_type (std::move (buf),
@@ -361,7 +361,7 @@ namespace xt
361
361
* @param l the layout_type of the xarray_adaptor
362
362
*/
363
363
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class T , std::size_t N, class SC ,
364
- XTL_REQUIRES (detail::is_array <std::decay_t <SC>>)>
364
+ XTL_REQUIRES (detail::has_fixed_size <std::decay_t <SC>>)>
365
365
inline auto adapt(T (&c_array)[N], const SC& shape, layout_type l = L)
366
366
{
367
367
return adapt (&c_array[0 ], N, xt::no_ownership (), shape, l);
@@ -375,7 +375,7 @@ namespace xt
375
375
* @param strides the strides of the xarray_adaptor
376
376
*/
377
377
template <class T , std::size_t N, class SC , class SS ,
378
- XTL_REQUIRES (detail::is_array <std::decay_t <SC>>,
378
+ XTL_REQUIRES (detail::has_fixed_size <std::decay_t <SC>>,
379
379
detail::not_a_layout<std::decay_t <SS>>)>
380
380
inline auto adapt(T (&c_array)[N], SC&& shape, SS&& strides)
381
381
{
@@ -557,7 +557,7 @@ namespace xt
557
557
* @return xarray_adaptor for memory
558
558
*/
559
559
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class P , class SC ,
560
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>)>
560
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>)>
561
561
auto adapt_smart_ptr(P&& smart_ptr, const SC& shape, layout_type l = L)
562
562
{
563
563
using buffer_adaptor = xbuffer_adaptor<decltype (smart_ptr.get ()), smart_ownership,
@@ -619,7 +619,7 @@ namespace xt
619
619
* @return xarray_adaptor on the memory
620
620
*/
621
621
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class P , class SC , class D ,
622
- XTL_REQUIRES (detail::not_an_array <std::decay_t <SC>>,
622
+ XTL_REQUIRES (detail::has_dynamic_size <std::decay_t <SC>>,
623
623
detail::not_a_layout<std::decay_t <D>>)>
624
624
auto adapt_smart_ptr(P&& data_ptr, const SC& shape, D&& smart_ptr, layout_type l = L)
625
625
{
0 commit comments