P3982R0 — Fix meaning of strided_slice::extent for C++26
(30 items)
Library Evolution Working Group
This paper proposes renaming strided_slice to extent_slice and redefining its extent member to represent the output extent (number of elements) rather than the input span, resolving ambiguity and enabling zero strides and static extents with dynamic strides. It also proposes a new range_slice vocabulary type expressing the (first, last, stride) interface consistent with other programming languages, and extends slice canonicalization to accept any type decomposable into three values as a (first, last, stride) slice. The rename and semantic fix target C++26, while range_slice and decomposable slice extensions may target later standards.
-
§6 (Proposed Wording), canonical-slice definition, is-strided-slice
branch— .offset is initialized from s.extent and .extent is initialized from s.offset — the two initializers are swapped relative to the correct mapping. [1] - §6 (Proposed Wording), exposition-only helpers — The function is defined as canonical-range-slice but invoked as canonical-slice-range; the names do not match. [2]
- §6 (Proposed Wording), canonical-range-slice Returns clause — .offset = first uses the identifier first, but the function parameter is named offset; first is undeclared in this scope. [3]
- §1 (Introduction) item 1; §4 (Ship vehicle) item 1 — These two locations say extent_stride, but the rest of the paper consistently uses extent_slice as the proposed name. [4]
- §6 (Proposed Wording), inserted paragraph -8.1.3- — "greater then zero" — then should be than. [5]
- §6 (Proposed Wording), paragraph -8.1.3- sub-items — Two sub-items are both numbered -8.1.3.2-; the first should be -8.1.3.1-. [6]
- §6 (Proposed Wording), paragraph -4- sub-items — Sub-item numbered -4.2.2- is nested under -4.3-; should be -4.3.2-. [7]
- §6 (Proposed Wording), Mandates clause (-6-) — IndexTye is missing the 'p'; should be IndexType. [8]
- §6 (Proposed Wording), canonical-range-slice Let clause — StridesTypes has an extra 's'; should be StrideTypes to match the template parameter pack declaration. [9]
- §6 (Proposed Wording), canonical-range-slice Mandates clause — sizeof.. has only two dots; the C++ operator requires three: sizeof...(StrideTypes). [10]
- §6 (Proposed Wording), [mdspan.sub.helpers] canonical-index — Corrupted HTML entity renders as templatelt;class IndexType... — the opening angle bracket is garbled. [11]
- §6 (Proposed Wording), inserted paragraph -8.1.3.2- (first occurrence) — Missing "is a" before "specialization"; should read "if S::offset_type is a specialization of constant_wrapper". [12]
- §6 (Proposed Wording), [mdspan.sub.strided.slice] Note — Broken diff markup for "indicates": indicates has two closing tags with no matching opener for the trailing 's'. [13]
- §3.3 (Example of static output extent usage), code sample — sumdspan is misspelled; should be submdspan. [14]
- §3.4 (Example of zero stride value usage), code sample — Missing closing parenthesis for submdspan(; line ends {3, 5, 0}; instead of {3, 5, 0});. [15]
- §3.1, language survey list — The link labeled "rust" points to docs.python.org (Python documentation), not Rust documentation. [16]
- §4.1 (Proposed polls) — Both polls are numbered "3."; the second should be "4." [17]
- §3.1 (Introducing range_slice), range_slice definition — [[no_unique_addresss]] has three s's in all three occurrences; the correct attribute is [[no_unique_address]]. [18]
- §4.2 heading — stride_slice is neither the current name (strided_slice) nor the proposed name (extent_slice). [19]
- §3.1 — stride_slice::extent is missing the 'd'; should be strided_slice::extent. [20]
- §3.3 — Doubled phrase: "the number of number of" — delete the duplicate. [21]
- §6 (Proposed Wording), first paragraph — The anchor element wrapping the N5032 reference has no text content; "N5032" appears outside the tag and is not hyperlinked. [22]
- §3.1 — Stray closing tag with no matching opening tag. [23]
- §§3.4/3.5 and §§4.0/4.1 — Duplicate HTML anchors: sections 3.4 and 3.5 share motivation.zero-stride; sections 4.0 and 4.1 share ship-vehicle. [24]
- §3.1 — Futhermore — misspelled; should be Furthermore. [25]
- §3.1 — inituition — misspelled; should be intuition. [26]
- §4.2 — mininal — misspelled; should be minimal. [27]
- §4.3 — severly — misspelled; should be severely. [28]
- §4.3 — familar — misspelled; should be familiar. [29]
References — Anthropic Citations API
[1]
"(§1) "Rename strided_slice to extent_stride and adjust the meaning of its extent member" / (§4) "Rename strided_slice to extent_stride and adjust the meaning of extent member""
"(§1) "Rename strided_slice to extent_stride and adjust the meaning of its extent member" / (§4) "Rename strided_slice to extent_stride and adjust the meaning of extent member""
[2]
""auto smd = sumdspan(md, strided_slice{cw<0>, cw<5>, md.extents()[0] / 5})""
""auto smd = sumdspan(md, strided_slice{cw<0>, cw<5>, md.extents()[0] / 5})""
[3]
""auto smd = submdspan(md, strided_slice{3, 5, 0};""
""auto smd = submdspan(md, strided_slice{3, 5, 0};""
[4]
""return strided_slice{ .offset = canonical-index(std::move(s.extent)), .extent = canonical-index(std::move(s.offset)), .stride = canonical-index(std::move(s.stride)) }""
""return strided_slice{ .offset = canonical-index
[5]
"Definition: "constexpr auto canonical-range-slice(OffsetType offset, SpanType span, StrideTypes... strides);" / Call site: "return canonical-slice-range(""
"Definition: "constexpr auto canonical-range-slice(OffsetType offset, SpanType span, StrideTypes... strides);" / Call site: "return canonical-slice-range
[6]
""strided_slice{ .offset = first, .extent = extent, .stride = stride };""
""strided_slice{ .offset = first, .extent = extent, .stride = stride };""
[7]
""templatelt&;class IndexType, class S>""
""templatelt&;class IndexType, class S>""
[8]
""[[no_unique_addresss]] FirstType first{};" (repeated for all three members)"
""[[no_unique_addresss]] FirstType first{};" (repeated for all three members)"
[9]
""S is a submdspan slice type for IndexTye.""
""S is a submdspan slice type for IndexTye.""
[10]
""stride_slice needs to target C++26""
""stride_slice needs to target C++26""
[11]
""StridesTypes...[0] otherwise;""
""StridesTypes...[0] otherwise;""
[12]
""sizeof..(StrideTypes) <= 1""
""sizeof..(StrideTypes) <= 1""
[13]
""Futhermore, we propose to introduce a new vocabulary type""
""Futhermore, we propose to introduce a new vocabulary type""
[14]
""Based on the inituition built from other languages""
""Based on the inituition built from other languages""
[15]
""it is important that the interface is both mininal""
""it is important that the interface is both mininal""
[16]
""the ergonomics of submdspan would be severly degraded""
""the ergonomics of submdspan would be severly degraded""
[17]
""even for programmers familar with the topic""
""even for programmers familar with the topic""
[18]
""S::extent_type::value is greater then zero""
""S::extent_type::value is greater then zero""
[19]
""3. Accept any type decomposable into three elements as submdspan slice type as proposed in P3982R0 to C++29." followed by "3. Accept any type decomposable into three elements as submdspan slice..."
""3. Accept any type decomposable into three elements as submdspan slice type as proposed in P3982R0 to C++29." followed by "3. Accept any type decomposable into three elements as submdspan slice..."
[21]
""indicates""
""indicates""
[22]
""One argument for using the input span as the value of stride_slice::extent""
""One argument for using the input span as the value of stride_slice::extent""
[23]
""if S::offset_type specialization of constant_wrapper""
""if S::offset_type specialization of constant_wrapper""
[24]
"First: "-8.1.3.2- if S::offset_type specialization of constant_wrapper" / Second: "-8.1.3.2- if S::stride_type is specialization of constant_wrapper""
"First: "-8.1.3.2- if S::offset_type specialization of constant_wrapper" / Second: "-8.1.3.2- if S::stride_type is specialization of constant_wrapper""
[25]
""-4.2.2- if S::stride_type and S::extent_type are both specializations of constant_wrapper""
""-4.2.2- if S::stride_type and S::extent_type are both specializations of constant_wrapper""
[26]
""Note that the number of number of elements in the smd is always known statically""
""Note that the number of number of elements in the smd is always known statically""
[28]
""the third value is the stride.""
""the third value is the stride.""
Summary: P3982R0 proposes three changes to strided_slice for C++26: redefining the extent member to denote the number of elements rather than the index-space end, renaming strided_slice to extent_slice, and adding a range_slice helper that preserves the old offset/extent/stride interface. The proposed wording contains several substantive errors in the normative text alongside numerous surface-level typos and markup defects.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.