Skip to content

Commit

Permalink
change convert for less invalidations?
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Oct 26, 2024
1 parent 2628163 commit 50e9085
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/convert.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
function Base.convert(::Type{T}, a::StridedView) where {T<:Array}
b = T(undef, size(a))
function Base.Array(a::StridedView)
b = Array{eltype(a)}(undef, size(a))
copyto!(StridedView(b), a)
return b
end
function Base.convert(::Type{Array}, a::StridedView{T}) where {T}

function (Base.Array{T})(a::StridedView{S,N}) where {T,S,N}
b = Array{T}(undef, size(a))
copyto!(StridedView(b), a)
return b
end

function (Base.Array{T,N})(a::StridedView{S,N}) where {T,S,N}
b = Array{T}(undef, size(a))
copyto!(StridedView(b), a)
return b
Expand Down

0 comments on commit 50e9085

Please sign in to comment.