Skip to content

Commit

Permalink
Merge pull request #682 from vyudu/add_create_array_method
Browse files Browse the repository at this point in the history
Add `create_array` method for `ReinterpretArray`
  • Loading branch information
ChrisRackauckas authored Jan 8, 2025
2 parents 62283ca + cc2e4df commit 1b3f395
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/code.jl
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,16 @@ end
typed_vhcat(T, dims, elems...)
end

@inline function create_array(::Type{<:Base.ReinterpretArray}, ::Nothing,
::Val{1}, ::Val{dims}, elems...) where {dims}
[elems...]
end

@inline function create_array(
::Type{<:Base.ReinterpretArray}, T, ::Val{1}, ::Val{dims}, elems...) where {dims}
T[elems...]
end


vhcat(sz::Tuple{Int,Int}, xs::T...) where {T} = typed_vhcat(T, sz, xs...)
vhcat(sz::Tuple{Int,Int}, xs::Number...) = typed_vhcat(Base.promote_typeof(xs...), sz, xs...)
Expand Down

0 comments on commit 1b3f395

Please sign in to comment.