File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ macro implement_array_methods(t)
3
3
t = esc (t)
4
4
quote
5
5
Base. Array (a:: $t ) = $ _Array (a)
6
+ Base. collect (a:: $t ) = $ _Array (a)
6
7
Base. copyto! (dest:: $t , source:: AbstractArray ) = $ _copyto! (dest, source)
7
8
Base. copyto! (dest:: AbstractArray , source:: $t ) = $ _copyto! (dest, source)
8
9
Base. copyto! (dest:: $t , source:: $t ) = $ _copyto! (dest, source)
@@ -46,11 +47,8 @@ macro implement_array_methods(t)
46
47
end
47
48
48
49
# Use broadcast to copy to a new Array
49
- function _Array (a:: AbstractArray{T,N} ) where {T,N}
50
- dest = Array {T,N} (undef, size (a))
51
- dest .= a
52
- return dest
53
- end
50
+ _Array (a:: AbstractArray{T,N} ) where {T,N} = a[ntuple (_ -> :, Val {N} ())... ]
51
+ _Array (a:: AbstractArray{T,0} ) where {T} = fill (a[])
54
52
55
53
# Use broadcast to copy
56
54
function _copyto! (dest:: AbstractArray{<:Any,N} , source:: AbstractArray{<:Any,N} ) where {N}
You can’t perform that action at this time.
0 commit comments