Skip to content

Commit

Permalink
make A[:, end] error for ragged AbstractVectorOfArray when the length…
Browse files Browse the repository at this point in the history
…s are not equal
  • Loading branch information
oscardssmith committed Jul 12, 2023
1 parent 7a3c3e4 commit 6df1fc7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/vector_of_array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,10 @@ end
end
unpack_args_voa(i, args::Tuple{Any}) = (unpack_voa(args[1], i),)
unpack_args_voa(::Any, args::Tuple{}) = ()

function Base.lastindex(A::AbstractVectorOfArray, i=1)
i == 1 && return length(A)
len1 = lastindex(A[1], i-1)
all(x->isequal(lastindex(x, i-1), len1), A) && return len1
throw(ArgumentError("Can not get lastindex of an AbstractVectorOfArray for dimensions other than 1"))
end

0 comments on commit 6df1fc7

Please sign in to comment.