Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IteratorSize for a StructArray #290

Merged
merged 3 commits into from
Dec 20, 2023
Merged

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Dec 12, 2023

This makes the following fail instead of running out of memory:

julia> using StructArrays, InfiniteArrays

julia> S = StructArray{Complex{Int}}((1:∞, 1:∞));

julia> collect(i for i in S)
ERROR: MethodError: no method matching _similar_shape(::Base.Generator{StructVector{Complex{Int64}, NamedTuple{(:re, :im), Tuple{InfiniteArrays.InfUnitRange{Int64}, InfiniteArrays.InfUnitRange{Int64}}}, Int64}, typeof(identity)}, ::Base.IsInfinite)

src/structarray.jl Outdated Show resolved Hide resolved
@piever
Copy link
Collaborator

piever commented Dec 14, 2023

Thanks, looks good! Happy to merge after a rebase (sorry, might have created some conflicts on the Project file with the sparse arrays PR).

jishnub and others added 2 commits December 14, 2023 21:47
Co-authored-by: Pietro Vertechi <pietro.vertechi@protonmail.com>
@piever piever merged commit d9791eb into JuliaArrays:master Dec 20, 2023
7 checks passed
@jishnub jishnub deleted the IteratorSize branch December 20, 2023 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants