Skip to content

Commit 8b7627f

Browse files
Merge pull request #355 from lxvm/patch-1
Update vector_of_array.jl
2 parents e00bdb2 + d06b8a6 commit 8b7627f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/vector_of_array.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N},
304304
return Adapt.adapt(__parameterless_type(T),
305305
reshape(reduce(hcat, vecs), size(A.u[1])..., length(A.u)))
306306
end
307+
Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N},
308+
::NotSymbolic, I::Colon...) where {T <: Number, N}
309+
@assert length(I) == ndims(A.u)
310+
return A.u[I...]
311+
end
307312

308313
Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N},
309314
::NotSymbolic, I::AbstractArray{Bool},

test/basic_indexing.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,6 @@ foo!(u_vector)
257257
# test efficiency
258258
num_allocs = @allocations foo!(u_matrix)
259259
@test num_allocs == 0
260+
261+
# issue 354
262+
@test VectorOfArray(ones(1))[:] == ones(1)

0 commit comments

Comments
 (0)