This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
stride_view iterator operations are missing preconditionsSection: 25.7.32.3 [range.stride.iterator] Status: New Submitter: S. B. Tam Opened: 2026-08-17 Last modified: 2026-08-22
Priority: Not Prioritized
View other active issues in [range.stride.iterator].
View all other issues in [range.stride.iterator].
View all issues with New status.
Discussion:
stride_view's iterator comparison and subtraction do not require the iterators to come from the
same range and have the same stride, and thus seem to permit nonsensical code like:
#include <ranges>
int arr[] = {1, 2, 3, 4, 5, 6, 7};
auto r1 = std::views::stride(arr, 2);
auto r2 = std::views::stride(arr, 6);
auto it1 = r1.end(); // it1.missing_ == 1
auto it2 = r2.end(); // it2.missing_ == 5
auto x = r1.end() - r2.end(); // x == (0 + 1 - 5) / 2
Should these operations have preconditions to treat such cases as UB?
Proposed resolution: