Showing with 9 additions and 1 deletion.
  1. +9 −1 std/experimental/ndslice/selection.d
10 changes: 9 additions & 1 deletion std/experimental/ndslice/selection.d
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ auto byElement(size_t N, Range)(auto ref Slice!(N, Range) slice)
_indexes[i] = n;
n = _indexes[i - 1] + v;
}
assert(n < _slice._lengths[0]);
assert(n <= _slice._lengths[0]);
with (_slice)
{
_shift += (n - _indexes[0]) * _strides[0];
Expand Down Expand Up @@ -1381,6 +1381,14 @@ unittest
static assert(hasSlicing!B);
}

// Issue 16010
unittest
{
auto s = iotaSlice(3, 4).byElement;
foreach (_; 0 .. s.length)
s = s[1 .. $];
}

/++
Returns an forward range of all elements of standard simplex of a slice.
In case the slice has two dimensions, it is composed of elements of upper left triangular matrix.
Expand Down