Skip to content

Commit 430a1c9

Browse files
committed
Make stepper_begin and stepper_end templates
1 parent 711536b commit 430a1c9

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

include/xtensor-python/pyarray.hpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,15 @@ namespace xt
165165
template <class S>
166166
xiterator<const_stepper, S> cxend(const S& shape) const;
167167

168-
stepper stepper_begin(const shape_type& shape);
169-
stepper stepper_end(const shape_type& shape);
168+
template <class S>
169+
stepper stepper_begin(const S& shape);
170+
template <class S>
171+
stepper stepper_end(const S& shape);
170172

171-
const_stepper stepper_begin(const shape_type& shape) const;
172-
const_stepper stepper_end(const shape_type& shape) const;
173+
template <class S>
174+
const_stepper stepper_begin(const S& shape) const;
175+
template <class S>
176+
const_stepper stepper_end(const S& shape) const;
173177

174178
storage_iterator storage_begin();
175179
storage_iterator storage_end();
@@ -474,28 +478,32 @@ namespace xt
474478
}
475479

476480
template <class T, int ExtraFlags>
477-
inline auto pyarray<T, ExtraFlags>::stepper_begin(const shape_type& shape) -> stepper
481+
template <class S>
482+
inline auto pyarray<T, ExtraFlags>::stepper_begin(const S& shape) -> stepper
478483
{
479484
size_type offset = shape.size() - dimension();
480485
return stepper(this, storage_begin(), offset);
481486
}
482487

483488
template <class T, int ExtraFlags>
484-
inline auto pyarray<T, ExtraFlags>::stepper_end(const shape_type& shape) -> stepper
489+
template <class S>
490+
inline auto pyarray<T, ExtraFlags>::stepper_end(const S& shape) -> stepper
485491
{
486492
size_type offset = shape.size() - dimension();
487493
return stepper(this, storage_end(), offset);
488494
}
489495

490496
template <class T, int ExtraFlags>
491-
inline auto pyarray<T, ExtraFlags>::stepper_begin(const shape_type& shape) const -> const_stepper
497+
template <class S>
498+
inline auto pyarray<T, ExtraFlags>::stepper_begin(const S& shape) const -> const_stepper
492499
{
493500
size_type offset = shape.size() - dimension();
494501
return const_stepper(this, storage_begin(), offset);
495502
}
496503

497504
template <class T, int ExtraFlags>
498-
inline auto pyarray<T, ExtraFlags>::stepper_end(const shape_type& shape) const -> const_stepper
505+
template <class S>
506+
inline auto pyarray<T, ExtraFlags>::stepper_end(const S& shape) const -> const_stepper
499507
{
500508
size_type offset = shape.size() - dimension();
501509
return const_stepper(this, storage_end(), offset);

0 commit comments

Comments
 (0)