Title
datapar::chunk<N> should use simd-size-type instead of size_t
Status
new
Section
[simd.syn][simd.creation]
Submitter
Matthias Kretz

Created on 2025-03-22.00:00:00 last changed 2 weeks ago

Messages

Date: 2025-03-22.16:50:56

Proposed resolution:

This wording is relative to N5008.

  1. Modify [simd.syn], header <simd> synopsis, as indicated:

    namespace std::datapar {
      […]
      template<simd-size-typesize_t N, class T, class Abi>
        constexpr auto chunk(const basic_simd<T, Abi>& x) noexcept;
      template<simd-size-typesize_t N, size_t Bytes, class Abi>
        constexpr auto chunk(const basic_simd_mask<Bytes, Abi>& x) noexcept;
      […]
    }
    
  2. Modify [simd.creation] as indicated:

    template<simd-size-typesize_t N, class T, class Abi>
      constexpr auto chunk(const basic_simd<T, Abi>& x) noexcept;
    

    -4- Effects: Equivalent to: return chunk<resize_t<N, basic_simd<T, Abi>>>(x);

    template<simd-size-typesize_t N, size_t Bytes, class Abi>
      constexpr auto chunk(const basic_simd_mask<Bytes, Abi>& x) noexcept;
    

    -5- Effects: Equivalent to: return chunk<resize_t<N, basic_simd_mask<Bytes, Abi>>>(x);

Date: 2025-03-22.00:00:00

All index values and simd widths in subclause "Data-parallel types" use the type simd-size-type. Specifically, the NTTP of `std::datapar::resize` uses simd-size-type and `std::datapar::chunk` is "implemented" using `std::datapar::resize`.

For chunk<N>, N is of type `size_t` and needs to be converted to simd-size-type in the effects clause where it is passed to resize. The NTTP of chunk should use simd-size-type instead of `size_t`.

History
Date User Action Args
2025-03-22 16:50:56adminsetmessages: + msg14700
2025-03-22 00:00:00admincreate