We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents abbdc6a + 7c07fe6 commit 82eae65Copy full SHA for 82eae65
src/ranges.jl
@@ -399,7 +399,11 @@ end
399
const OptionallyStaticRange = Union{<:OptionallyStaticUnitRange,<:OptionallyStaticStepRange}
400
401
Base.eachindex(r::OptionallyStaticRange) = r
402
-@inline Base.iterate(r::OptionallyStaticRange) = (fi = Int(first(r)); (fi, fi))
+@inline function Base.iterate(r::OptionallyStaticRange)
403
+ isempty(r) && return nothing
404
+ fi = Int(first(r));
405
+ fi, fi
406
+end
407
408
Base.to_shape(x::OptionallyStaticRange) = length(x)
409
Base.to_shape(x::Slice{T}) where {T<:OptionallyStaticRange} = length(x)
0 commit comments