Skip to content

Commit

Permalink
Override iterate for BatchView
Browse files Browse the repository at this point in the history
  • Loading branch information
darsnack committed Feb 22, 2022
1 parent a771cea commit c0a19e3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/batchview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ function Base.getindex(A::BatchView, is::AbstractVector)
obsview(A.data, obsindices)
end

# override AbstractDataContainer default
Base.iterate(A::BatchView, state = 1) =
(state > numobs(A)) ? nothing : (A[state], state + 1)

obsview(A::BatchView) = A
obsview(A::BatchView, i) = A[i]

Expand Down

0 comments on commit c0a19e3

Please sign in to comment.