Skip to content

Commit 40ccaf8

Browse files
committed
Define recursivefill! variants
1 parent cba251a commit 40ccaf8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/utils.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ function recursivefill!(b::AbstractArray{T, N},
8686
end
8787
end
8888

89+
function recursivefill!(bs::AbstractVectorOfArray{T, N},
90+
a::T2) where {T <: StaticArraysCore.StaticArray,
91+
T2 <: StaticArraysCore.StaticArray, N}
92+
@inbounds for b in bs, i in eachindex(b)
93+
b[i] = copy(a)
94+
end
95+
end
96+
8997
function recursivefill!(b::AbstractArray{T, N},
9098
a::T2) where {T <: StaticArraysCore.SArray,
9199
T2 <: Union{Number, Bool}, N}
@@ -94,6 +102,14 @@ function recursivefill!(b::AbstractArray{T, N},
94102
end
95103
end
96104

105+
function recursivefill!(bs::AbstractVectorOfArray{T, N},
106+
a::T2) where {T <: StaticArraysCore.SArray,
107+
T2 <: Union{Number, Bool}, N}
108+
@inbounds for b in bs, i in eachindex(b)
109+
b[i] = fill(a, typeof(b[i]))
110+
end
111+
end
112+
97113
function recursivefill!(b::AbstractArray{T, N}, a::T2) where {T <: Enum, T2 <: Enum, N}
98114
fill!(b, a)
99115
end

0 commit comments

Comments
 (0)