rangeUnchecked method

Vector<T> rangeUnchecked(
  1. int start,
  2. int end
)

Returns a mutable view onto a Vector range. The behavior is undefined, if the range is out of bounds.

Implementation

Vector<T> rangeUnchecked(int start, int end) {
  if (start == 0 && end == count) return this;
  return switch (this) {
    RangeVector<T>(vector: final thisVector, start: final thisStart) =>
      RangeVector<T>(thisVector, thisStart + start, thisStart + end),
    _ => RangeVector<T>(this, start, end),
  };
}