Created on 2025-05-22.00:00:00 last changed 1 week ago
Proposed resolution:
This wording is relative to N5008.
Modify [mdspan.layout.stride.overview] as indicated:
namespace std { template<class Extents> class layout_stride::mapping { […] static constexpr bool is_always_unique() noexcept { return true; } static constexpr bool is_always_exhaustive() noexcept;{ return false; }static constexpr bool is_always_strided() noexcept { return true; } […] }; }
Modify [mdspan.layout.stride.obs] as indicated:
[…]
static constexpr bool is_always_exhaustive() noexcept;-?- Returns: `true` if rank_ is `0` or if there is a rank index `r` of `extents()` such that `extents_type::static_extent(r)` is `0`, otherwise `false`.
constexpr bool is_exhaustive() const noexcept;-5- Returns:
(5.1) — `true` if rank_ or the size of the multidimensional index space `m.extents()` is `0`.
(5.2) — […]
(5.3) — […]
Mapping over an empty multidimensional index space is always exhaustive according to the corresponding definitions from [mdspan.layout.reqmts] p16.
However, the current specification of `layout_stride::mapping` does not consider whether some of the empty multidimensional index spaces are unique or exhaustive. For illustration, the mapping with the following configuration is not considered exhaustive according to the current specification of [mdspan.layout.stride.obs] bullet 5.2:extents: 2, 2, 0 strides: 2, 6, 20
This prevents the implementation from implementing `sm.is_exhaustive()` as sm.fwd-prod-of-extents(sm::extents_type::rank()) == sm.required_span_size(). For all mappings with size greater than zero, such an expression provides an answer consistent with the standard. However, it always returns `true` for an empty mapping, such as shown in the example.
We should make such implementation conforming, and require `is_exhaustive()` to return `true` for empty mappings. For consistency, we could update `is_always_exhaustive()` to recognize mapping with `rank() == 0`, and one for which at least one of the static extents is equal to zero (i.e., they always represent a multidimensional index space).History | |||
---|---|---|---|
Date | User | Action | Args |
2025-05-24 10:35:08 | admin | set | messages: + msg14768 |
2025-05-22 00:00:00 | admin | create |