Skip to content

Commit 6df1fc7

Browse files
committed
make A[:, end] error for ragged AbstractVectorOfArray when the lengths are not equal
1 parent 7a3c3e4 commit 6df1fc7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/vector_of_array.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,3 +541,10 @@ end
541541
end
542542
unpack_args_voa(i, args::Tuple{Any}) = (unpack_voa(args[1], i),)
543543
unpack_args_voa(::Any, args::Tuple{}) = ()
544+
545+
function Base.lastindex(A::AbstractVectorOfArray, i=1)
546+
i == 1 && return length(A)
547+
len1 = lastindex(A[1], i-1)
548+
all(x->isequal(lastindex(x, i-1), len1), A) && return len1
549+
throw(ArgumentError("Can not get lastindex of an AbstractVectorOfArray for dimensions other than 1"))
550+
end

0 commit comments

Comments
 (0)