Skip to content

Commit 5bd32a2

Browse files
committed
generalise Base.iterate
1 parent 6e3fca5 commit 5bd32a2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/bimodulesector.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ Base.size(::Type{A4Object}) = 7
3737

3838
Base.IteratorSize(::Type{<:SectorValues{<:BimoduleSector}}) = Base.SizeUnknown()
3939

40-
# TODO: generalize?
41-
function Base.iterate(iter::SectorValues{A4Object}, (I, label)=(1, 1))
42-
s = size(A4Object)
40+
function Base.iterate(iter::SectorValues{<:BimoduleSector}, (I, label)=(1, 1))
41+
A = eltype(iter)
42+
s = size(A)
4343
I > s * s && return nothing
4444
i, j = CartesianIndices((s, s))[I].I
45-
maxlabel = _numlabels(A4Object, i, j)
45+
maxlabel = _numlabels(A, i, j)
4646
return if label > maxlabel
4747
iterate(iter, (I + 1, 1))
4848
else
49-
A4Object(i, j, label), (I, label + 1)
49+
A(i, j, label), (I, label + 1)
5050
end
5151
end
5252

0 commit comments

Comments
 (0)