File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,15 @@ to_css_size(s::Real) = "$(s)px"
22
22
struct IteratorAndFirst{F, T}
23
23
first:: F
24
24
source:: T
25
+ len:: Int
25
26
function IteratorAndFirst (x)
27
+ len = Base. haslength (x) ? length (x) : 0
26
28
first = iterate (x)
27
- return new {typeof(first), typeof(x)} (first, x)
29
+ return new {typeof(first), typeof(x)} (first, x, len )
28
30
end
29
31
end
30
32
Base. IteratorSize (:: Type{IteratorAndFirst{F, T}} ) where {F, T} = Base. IteratorSize (T)
31
- Base. length (x:: IteratorAndFirst ) = length (x . source)
33
+ Base. length (x:: IteratorAndFirst ) = x . len
32
34
Base. IteratorEltype (:: Type{IteratorAndFirst{F, T}} ) where {F, T} = Base. IteratorEltype (T)
33
35
Base. eltype (x:: IteratorAndFirst ) = eltype (x. source)
34
36
Base. iterate (x:: IteratorAndFirst ) = x. first
You can’t perform that action at this time.
0 commit comments