You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
construct empty vector with StructVector{Foo1}() #183
Adding the 1.0 milestone here because this would be a breaking change. There is a keyword constructor StructArray{T}(; kwargs...) to pass the named tuple of columns via kwargs (otherwise the extra parentheses get a bit annoying).
One reasonable (but still breaking) solution could be to only have the keyword constructor when no eltype parameter is passed, and create the empty StructArray otherwise.
Btw, I was actually not aware of the Vector{T}() constructor, is it also documented somewhere?
Activity
piever commentedon Apr 18, 2021
Adding the 1.0 milestone here because this would be a breaking change. There is a keyword constructor
StructArray{T}(; kwargs...)to pass the named tuple of columns viakwargs(otherwise the extra parentheses get a bit annoying).One reasonable (but still breaking) solution could be to only have the keyword constructor when no eltype parameter is passed, and create the empty
StructArrayotherwise.Btw, I was actually not aware of the
Vector{T}()constructor, is it also documented somewhere?goretkin commentedon Apr 23, 2021
The punny constructors like
Int64[]are defined in terms of e.g.Vector{Int64}()https://github.com/JuliaLang/julia/blob/fc02458492c60f6527245c6991f729c2a986f666/base/array.jl#L403-L411
It seems like the constructors don't have docstring:
https://github.com/JuliaLang/julia/blob/fc02458492c60f6527245c6991f729c2a986f666/base/boot.jl#L472
Not sure if they're documented elsewhere.