Skip to content

Commit 38dfc4a

Browse files
support MVector
1 parent 7388347 commit 38dfc4a

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RecursiveArrayTools"
22
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "2.26.1"
4+
version = "2.26.2"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/utils.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ function recursivefill!(b::AbstractArray{T,N},a::T2) where {T<:Union{Number,Bool
5555
fill!(b, a)
5656
end
5757

58+
function recursivefill!(b::AbstractArray{T,N},a) where {T<:MArray,N}
59+
@inbounds for i in eachindex(b)
60+
if isassigned(b,i)
61+
recursivefill!(b[i],a)
62+
else
63+
b[i] = zero(eltype(b))
64+
recursivefill!(b[i], a)
65+
end
66+
end
67+
end
68+
5869
function recursivefill!(b::AbstractArray{T,N},a) where {T<:AbstractArray,N}
5970
@inbounds for i in eachindex(b)
6071
recursivefill!(b[i], a)

test/utils_test.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,9 @@ recursivefill!(x, 1.0)
9393
x = [similar(x[1]), similar(x[1])]
9494
recursivefill!(x, true)
9595
@test x[1] == MVector{10}(ones(10))
96+
@test x[2] == MVector{10}(ones(10))
97+
98+
x = similar(x)
99+
recursivefill!(x, true)
100+
@test x[1] == MVector{10}(ones(10))
96101
@test x[2] == MVector{10}(ones(10))

0 commit comments

Comments
 (0)