diff --git a/include/xtensor/xstrided_view.hpp b/include/xtensor/xstrided_view.hpp index ab122a50f..f688a4138 100644 --- a/include/xtensor/xstrided_view.hpp +++ b/include/xtensor/xstrided_view.hpp @@ -809,22 +809,6 @@ namespace xt namespace detail { - // if shape is signed do the check - template - using do_shape_recalculation = std:: - enable_if_t::type>>::value, R>; - - // if shape is unsigned pass through - template - using no_shape_recalculation = std:: - enable_if_t::type>>::value, R>; - - template - inline no_shape_recalculation make_unsigned_shape(T shape) - { - return shape; - } - template struct rebind_shape; @@ -837,13 +821,16 @@ namespace xt template struct rebind_shape>>::value>> { - using Shape = rebind_container_t; + using type = rebind_container_t; }; - template = true> + template ::type>>::value, bool> = true> inline auto recalculate_shape_impl(S& shape, size_t size) { using value_type = get_value_type_t>; + const auto num_auto_dims = std::count(shape.cbegin(), shape.cend(), -1); + XTENSOR_ASSERT(num_auto_dims <= 1); auto iter = std::find(shape.begin(), shape.end(), -1); if (iter != std::end(shape)) { @@ -854,7 +841,8 @@ namespace xt return shape; } - template = true> + template ::type>>::value, bool> = true> inline auto recalculate_shape_impl(S& shape, size_t) { return shape; @@ -876,7 +864,7 @@ namespace xt ); using shape_type = std::decay_t; - using unsigned_shape_type = typename detail::rebind_shape::Shape; + using unsigned_shape_type = typename detail::rebind_shape::type; get_strides_t strides; detail::recalculate_shape(shape, e.size());