@@ -303,22 +303,6 @@ constexpr check_static_bounds_result check_static_bounds(
303303 }
304304}
305305
306- // ============================================================
307- // get_kth_in_pack: get the k-th element of a parameter pack
308- // ============================================================
309-
310- template <size_t k, class First , class ... Rest>
311- MDSPAN_INLINE_FUNCTION
312- constexpr decltype (auto ) get_kth_in_pack(First&& first, Rest&&... rest) {
313- static_assert (k <= sizeof ...(Rest));
314- if constexpr (k == 0 ) {
315- return std::forward<First>(first);
316- }
317- else {
318- return get_kth_in_pack<k - 1 >(std::forward<Rest>(rest)...);
319- }
320- }
321-
322306// ============================================================
323307// check_submdspan_slice_mandate: mandate check for the k-th slice
324308//
@@ -352,22 +336,23 @@ constexpr void check_submdspan_slice_mandates(
352336 const extents<IndexType, Extents...>& exts,
353337 Slices... slices)
354338{
355- (check_submdspan_slice_mandate<Inds>(exts, get_kth_in_pack<Inds>( slices...) ), ...);
339+ (check_submdspan_slice_mandate<Inds>(exts, slices), ...);
356340}
357341
358342// ============================================================
359- // submdspan_canonicalize_one_slice: canonicalize the k-th slice
343+ // submdspan_canonicalize_one_slice: canonicalize a single slice
360344//
361345// This function performs ONLY the conversion to canonical form.
362346// Mandate checking (static_asserts) is NOT done here; it is
363347// done separately by check_submdspan_slice_mandates.
348+ //
349+ // Templated only on IndexType (the extents index type) and Slice.
350+ // Neither k nor the extents are needed for the actual conversion.
364351// ============================================================
365352
366- template <size_t k, class Slice , class IndexType , size_t ... Extents >
353+ template <class IndexType , class Slice >
367354MDSPAN_INLINE_FUNCTION
368- constexpr auto submdspan_canonicalize_one_slice (
369- [[maybe_unused]] const extents<IndexType, Extents...>& exts,
370- [[maybe_unused]] Slice s)
355+ constexpr auto submdspan_canonicalize_one_slice ([[maybe_unused]] Slice s)
371356{
372357 if constexpr (std::is_convertible_v<Slice, full_extent_t >) {
373358 return full_extent; // canonical full-extent slice
@@ -447,10 +432,7 @@ constexpr auto submdspan_canonicalize_slices_impl(
447432
448433 // Actual canonicalization: returns detail::tuple for device compatibility.
449434 return detail::tuple{
450- submdspan_canonicalize_one_slice<Inds>(
451- exts,
452- get_kth_in_pack<Inds>(slices...)
453- )...
435+ submdspan_canonicalize_one_slice<IndexType>(slices)...
454436 };
455437}
456438
0 commit comments