From c4e7a033c2578e983ff747c448efaa13a7db8bc4 Mon Sep 17 00:00:00 2001 From: N5N3 <2642243996@qq.com> Date: Mon, 21 Feb 2022 19:43:04 +0800 Subject: [PATCH] Add some comments to patch for `StaticArray` --- src/staticarrays_support.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/staticarrays_support.jl b/src/staticarrays_support.jl index d03be3b0..0c1357db 100644 --- a/src/staticarrays_support.jl +++ b/src/staticarrays_support.jl @@ -28,7 +28,10 @@ end StructArrays.component(s::FieldArray, i) = invoke(StructArrays.component, Tuple{Any, Any}, s, i) StructArrays.createinstance(T::Type{<:FieldArray}, args...) = invoke(createinstance, Tuple{Type{<:Any}, Vararg}, T, args...) +# StaticArrayStyle has no similar defined. +# Convert to `DefaultArrayStyle` to return a sized (Struct)Array. +# TODO: return a StaticArray? function Base.copy(bc::Broadcasted{StructArrayStyle{StaticArrayStyle{N},N}}) where {N} - B = convert(Broadcasted{StructArrayStyle{Broadcast.DefaultArrayStyle{N},N}}, bc) - copy(B) + bc′ = convert(Broadcasted{StructArrayStyle{Broadcast.DefaultArrayStyle{N},N}}, bc) + return copy(bc′) end