Skip to content

Commit 93d84ed

Browse files
authored
Base.length dispatch for ArrayPartition
This only works for partition elements that themselves have a length-on-type function, e.g. SVector or SMatrix.
1 parent 9b9d8e6 commit 93d84ed

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/array_partition.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,3 +503,5 @@ function Base.convert(::Type{ArrayPartition{T,S}}, A::ArrayPartition{<:Any,<:NTu
503503
ntuple((@inline i -> convert(S.parameters[i], A.x[i])), Val(N))
504504
)
505505
end
506+
507+
Base.length(::Type{<:ArrayPartition{F,T}}) where {F,T <: Tuple} = T.parameters .|> length |> sum

0 commit comments

Comments
 (0)