@@ -20,42 +20,23 @@ the compiler (the element type may optionally also be specified).
2020mutable struct MArray{S <: Tuple , T, N, L} <: StaticArray{S, T, N}
2121 data:: NTuple{L,T}
2222
23- function MArray {S,T,N,L} (x:: NTuple{L,T} ) where {S,T,N,L}
23+ function MArray {S,T,N,L} (x:: NTuple{L,T} ) where {S<: Tuple ,T,N,L}
2424 check_array_parameters (S, T, Val{N}, Val{L})
2525 new {S,T,N,L} (x)
2626 end
2727
28- function MArray {S,T,N,L} (x:: NTuple{L,Any} ) where {S,T,N,L}
28+ function MArray {S,T,N,L} (x:: NTuple{L,Any} ) where {S<: Tuple ,T,N,L}
2929 check_array_parameters (S, T, Val{N}, Val{L})
3030 new {S,T,N,L} (convert_ntuple (T, x))
3131 end
3232
33- function MArray {S,T,N,L} (:: UndefInitializer ) where {S,T,N,L}
33+ function MArray {S,T,N,L} (:: UndefInitializer ) where {S<: Tuple ,T,N,L}
3434 check_array_parameters (S, T, Val{N}, Val{L})
3535 new {S,T,N,L} ()
3636 end
3737end
3838
39- @generated function (:: Type{MArray{S,T,N}} )(x:: Tuple ) where {S,T,N}
40- return quote
41- $ (Expr (:meta , :inline ))
42- MArray {S,T,N,$(tuple_prod(S))} (x)
43- end
44- end
45-
46- @generated function (:: Type{MArray{S,T}} )(x:: Tuple ) where {S,T}
47- return quote
48- $ (Expr (:meta , :inline ))
49- MArray {S,T,$(tuple_length(S)),$(tuple_prod(S))} (x)
50- end
51- end
52-
53- @generated function (:: Type{MArray{S}} )(x:: T ) where {S, T <: Tuple }
54- return quote
55- $ (Expr (:meta , :inline ))
56- MArray {S,promote_tuple_eltype(T),$(tuple_length(S)),$(tuple_prod(S))} (x)
57- end
58- end
39+ @inline MArray {S,T,N} (x:: Tuple ) where {S<: Tuple ,T,N} = MArray {S,T,N,length(x)} (x)
5940
6041@generated function (:: Type{MArray{S,T,N}} )(:: UndefInitializer ) where {S,T,N}
6142 return quote
7152 end
7253end
7354
74- @inline MArray (a:: StaticArray{S,T} ) where {S<: Tuple ,T} = MArray {S,T} (Tuple (a))
75-
7655# ###################
7756# # MArray methods ##
7857# ###################
0 commit comments