Created on 2026-08-17.00:00:00 last changed 1 week ago
`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?
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-08-17 00:00:00 | admin | create | |