Skip to content

Commit 94aefd5

Browse files
committed
avoid creating Base arrays on copy
1 parent 4891a29 commit 94aefd5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/fixed_arrays.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ Base.length(::StaticVector{N}) where {N} = N
189189
Base.length(::Type{<: StaticVector{N}}) where {N} = N
190190
Base.ndims(::Type{<: StaticVector}) = 1
191191

192+
Base.copy(v::StaticVector) = deepcopy(v)
193+
192194
Base.vcat(a::StaticVector, b::StaticVector) = (a..., b...)
193195

194196
function Base.iterate(A::StaticVector, i=1)

src/mat.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Base.broadcastable(x::Mat) = x
5555
Base.BroadcastStyle(::Type{<: Mat{C, R}}) where {C, R} = StaticArrayStyle{Mat{C, R}}()
5656
Base.values(m::Mat) = m.values
5757

58+
Base.copy(mat::Mat) = deepcopy(mat)
59+
5860
function Mat{C, R, T}(::LinearAlgebra.UniformScaling) where {C, R, T}
5961
idx = CartesianIndices((R, C))
6062
data = ntuple(C * R) do i

0 commit comments

Comments
 (0)