Skip to content

Commit a5556f1

Browse files
authored
Merge pull request #160 from coroa/pr/fix_iteration
Fix iteration over Axis
2 parents 2a7081c + 6a1318d commit a5556f1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ Base.length(A::Axis) = length(A.val)
8181
(A::Axis{name})(i) where {name} = Axis{name}(i)
8282
Base.convert(::Type{Axis{name,T}}, ax::Axis{name,T}) where {name,T} = ax
8383
Base.convert(::Type{Axis{name,T}}, ax::Axis{name}) where {name,T} = Axis{name}(convert(T, ax.val))
84-
Base.iterate(a::Axis) = (a, nothing)
85-
Base.iterate(::Axis, ::Any) = nothing
84+
Base.iterate(A::Axis, i...) = Base.iterate(A.val, i...)
85+
86+
Base.IteratorSize(::Type{<:Axis}) = Base.HasShape{1}()
87+
Base.IteratorEltype(::Type{<:Axis}) = Base.HasEltype()
88+
8689
Base.iterate(::Type{T}) where {T<:Axis} = (T, nothing)
8790
Base.iterate(::Type{T}, ::Any) where {T<:Axis} = nothing
8891

0 commit comments

Comments
 (0)