We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
splice!
At a first glance, this seems to work. But maybe there are other corner cases or more performant versions...
using StructArrays function Base.splice!(s::StructVector{T}, index::Integer, vals=T[]) where T valsT = StructVector(vals) t = map((v, val) -> splice!(v, index, val), StructArrays.components(s), StructArrays.components(valsT)) return StructArrays.createinstance(T, t...) end function Base.splice!(s::StructVector{T}, indexes, vals=T[]) where T valsT = StructVector(vals) t = map((v, val) -> splice!(v, indexes, val), StructArrays.components(s), StructArrays.components(valsT)) return StructVector{T}(t) end a = [(1,'a'),(2,'b'),(3,'c')] |> StructVector new = (0,'x') splice!(a, 1, [new]) == (1, 'a') splice!(a, 1:0, [new,new]) |> isempty splice!(a, 4:5) == [(2,'b'),(3,'c')] a == [(0,'x'),(0,'x'),(0,'x')]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
At a first glance, this seems to work. But maybe there are other corner cases or more performant versions...
The text was updated successfully, but these errors were encountered: