diff --git a/src/vector_of_array.jl b/src/vector_of_array.jl index a76297c4..16b58279 100644 --- a/src/vector_of_array.jl +++ b/src/vector_of_array.jl @@ -528,13 +528,13 @@ function Base.view(A::AbstractVectorOfArray{T,N,<:AbstractVector{T}}, I::Vararg{ J = map(i->Base.unalias(A,i), to_indices(A, Base.tail(I))) end @boundscheck checkbounds(A, J...) - SubArray(IndexStyle(A), A, J, Base.index_dimsum(J...)) + SubArray(A, J) end function Base.view(A::AbstractVectorOfArray, I::Vararg{Any,M}) where {M} @inline J = map(i->Base.unalias(A,i), to_indices(A, I)) @boundscheck checkbounds(A, J...) - SubArray(IndexStyle(A), A, J, Base.index_dimsum(J...)) + SubArray(A, J) end function Base.SubArray(parent::AbstractVectorOfArray, indices::Tuple) @inline diff --git a/test/interface_tests.jl b/test/interface_tests.jl index 67266323..6dd7e04e 100644 --- a/test/interface_tests.jl +++ b/test/interface_tests.jl @@ -84,7 +84,7 @@ arrvb = Array(testvb) # view testvc = VectorOfArray([rand(1:10, 3, 3) for _ in 1:3]) arrvc = Array(testvc) -for idxs in [(2, 2, :), (2, :, 2), (:, 2, 2), (:, :, 2), (:, 2, :), (2, : ,:), (:, :, :)] +for idxs in [(2, 2, :), (2, :, 2), (:, 2, 2), (:, :, 2), (:, 2, :), (2, : ,:), (:, :, :), (1:2, 1:2, Bool[1, 0, 1]), (1:2, Bool[1, 0, 1], 1:2), (Bool[1, 0, 1], 1:2, 1:2)] arr_view = view(arrvc, idxs...) voa_view = view(testvc, idxs...) @test size(arr_view) == size(voa_view) @@ -93,11 +93,13 @@ end testvc = VectorOfArray(collect(1:10)) arrvc = Array(testvc) +bool_idx = rand(Bool, 10) for (voaidx, arridx) in [ ((:,), (:,)), ((3:5,), (3:5,)), ((:, 3:5), (3:5,)), ((1, 3:5), (3:5,)), + ((:, bool_idx), (bool_idx,)) ] arr_view = view(arrvc, arridx...) voa_view = view(testvc, voaidx...)