@@ -181,14 +181,17 @@ function Base.iterate(array::ResizableArray, state)
181181 return nothing
182182 end
183183 nindex, nstate = niterate
184+ while ! isassigned (array, nindex. I... )
185+ pstate = nstate
186+ niterate = iterate (indx, pstate)
187+ if isnothing (niterate)
188+ return nothing
189+ end
190+ nindex, nstate = niterate
191+ end
184192 return (array[nindex. I... ], isnothing (nstate) ? nothing : (indx, nstate))
185193end
186194
187- function Base. map (f, array:: ResizableArray{T, V, N} ) where {T, V, N}
188- result = map (f, array. data)
189- return ResizableArray (result)
190- end
191-
192195__length (array:: ResizableArray{T, V, N} ) where {T, V, N} = __recursive_length (Val (N), array. data)
193196
194197function __recursive_length (:: Val{N} , array) where {N}
241244function lastwithindex (array:: ResizableArray{T, V, N} ) where {T, V, N}
242245 for index in reverse (CartesianIndices (reverse (size (array)))) # TODO improve performance of this function since it uses splatting
243246 if isassigned (array, reverse (index. I)... ):: Bool
244- return (index, array[reverse (index. I)... ])
247+ return (CartesianIndex ( reverse ( index. I)) , array[reverse (index. I)... ])
245248 end
246249 end
247250end
0 commit comments