Skip to content

Commit c7ee8d3

Browse files
recursive copy doesn't matter if element type is the same, just class
1 parent 7346d2c commit c7ee8d3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ function recursivecopy{T<:AbstractArray,N}(a::AbstractArray{T,N})
66
[recursivecopy(x) for x in a]
77
end
88

9-
function recursivecopy!{T<:StaticArray,N}(b::AbstractArray{T,N},a::AbstractArray{T,N})
9+
function recursivecopy!{T<:StaticArray,T2<:StaticArray,N}(b::AbstractArray{T,N},a::AbstractArray{T2,N})
1010
@inbounds for i in eachindex(a)
1111
# TODO: Check for `setindex!`` and use `copy!(b[i],a[i])` or `b[i] = a[i]`, see #19
1212
b[i] = copy(a[i])
1313
end
1414
end
1515

16-
function recursivecopy!{T<:Number,N}(b::AbstractArray{T,N},a::AbstractArray{T,N})
16+
function recursivecopy!{T<:Number,T2<:Number,N}(b::AbstractArray{T,N},a::AbstractArray{T2,N})
1717
copy!(b,a)
1818
end
1919

20-
function recursivecopy!{T<:AbstractArray,N}(b::AbstractArray{T,N},a::AbstractArray{T,N})
20+
function recursivecopy!{T<:AbstractArray,T2<:AbstractArray,N}(b::AbstractArray{T,N},a::AbstractArray{T2,N})
2121
@inbounds for i in eachindex(a)
2222
recursivecopy!(b[i],a[i])
2323
end

0 commit comments

Comments
 (0)