diff --git a/gsl/multi_span b/gsl/multi_span index 0abc7c1..40752aa 100644 --- a/gsl/multi_span +++ b/gsl/multi_span @@ -443,7 +443,7 @@ namespace details template size_type linearize(const T& arr) const { - Expects(arr[Dim] < CurrentRange); // Index is out of range + Expects(arr[Dim] >= 0 && arr[Dim] < CurrentRange); // Index is out of range return this->Base::totalSize() * arr[Dim] + this->Base::template linearize(arr); } @@ -1510,7 +1510,7 @@ public: template 1), typename Ret = std::enable_if_t> constexpr Ret operator[](size_type idx) const noexcept { - Expects(idx < bounds_.size()); // index is out of bounds of the array + Expects(idx >= 0 && idx < bounds_.size()); // index is out of bounds of the array const size_type ridx = idx * bounds_.stride(); // index is out of bounds of the underlying data