@@ -193,7 +193,7 @@ namespace xt
193193 * @throws Assertion failure if `i != 0` for integral slices.
194194 * @throws Assertion failure if `i >= slice.size()` for non-integral slices.
195195 */
196- template <size_t I, std::integral Index>
196+ template <access_t ACCESS, size_t I, std::integral Index>
197197 size_t map_ith_index (const view_type& view, const Index i) const ;
198198
199199 /* *
@@ -490,16 +490,16 @@ namespace xt
490490 {
491491 if constexpr (ACCESS == access_t ::SAFE)
492492 {
493- return container.at (map_ith_index<Is>(view, indices[Is])...);
493+ return container.at (map_ith_index<ACCESS, Is>(view, indices[Is])...);
494494 }
495495 else
496496 {
497- return container (map_ith_index<Is>(view, indices[Is])...);
497+ return container (map_ith_index<ACCESS, Is>(view, indices[Is])...);
498498 }
499499 }
500500
501501 template <class UnderlyingContainer , class ... Slices>
502- template <size_t I, std::integral Index>
502+ template <access_t ACCESS, size_t I, std::integral Index>
503503 auto
504504 index_mapper<xt::xview<UnderlyingContainer, Slices...>>::map_ith_index(const view_type& view, const Index i) const
505505 -> size_t
@@ -518,10 +518,17 @@ namespace xt
518518 assert (i == 0 );
519519 return size_t (slice);
520520 }
521+ else if constexpr (xt::detail::is_xall_slice<std::decay_t <current_slice>>::value)
522+ {
523+ return size_t (i);
524+ }
521525 else
522526 {
523527 using slice_size_type = typename current_slice::size_type;
524- assert (i < slice.size ());
528+ if constexpr (ACCESS == access_t ::UNSAFE)
529+ {
530+ assert (static_cast <slice_size_type>(i) < slice.size ());
531+ }
525532 return size_t (slice (static_cast <slice_size_type>(i)));
526533 }
527534 }
0 commit comments