Skip to content

Commit 1b3f395

Browse files
Merge pull request #682 from vyudu/add_create_array_method
Add `create_array` method for `ReinterpretArray`
2 parents 62283ca + cc2e4df commit 1b3f395

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/code.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,16 @@ end
527527
typed_vhcat(T, dims, elems...)
528528
end
529529

530+
@inline function create_array(::Type{<:Base.ReinterpretArray}, ::Nothing,
531+
::Val{1}, ::Val{dims}, elems...) where {dims}
532+
[elems...]
533+
end
534+
535+
@inline function create_array(
536+
::Type{<:Base.ReinterpretArray}, T, ::Val{1}, ::Val{dims}, elems...) where {dims}
537+
T[elems...]
538+
end
539+
530540

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

0 commit comments

Comments
 (0)