@@ -17,7 +17,7 @@ Construct a statically-sized, mutable array of dimensions `S` (expressed as a `T
1717using the data from `a`. The `S` parameter is mandatory since the size of `a` is unknown to
1818the compiler (the element type may optionally also be specified).
1919"""
20- type MArray{S, T, N, L} <: StaticArray{S, T, N}
20+ type MArray{S <: Tuple , T, N, L} <: StaticArray{S, T, N}
2121 data:: NTuple{L,T}
2222
2323 function (:: Type{MArray{S,T,N,L}} ){S,T,N,L}(x:: NTuple{L,T} )
@@ -91,14 +91,14 @@ function getindex(v::MArray, i::Int)
9191 v. data[i]
9292end
9393
94- @propagate_inbounds setindex! {S,T} (v:: MArray{S,T} , val, i:: Int ) = setindex! (v, convert (T, val), i)
95- @inline function setindex! {S,T} (v:: MArray{S,T} , val:: T , i:: Int )
94+ @inline function setindex! (v:: MArray , val, i:: Int )
9695 @boundscheck if i < 1 || i > length (v)
9796 throw (BoundsError ())
9897 end
9998
99+ T = eltype (v)
100100 if isbits (T)
101- unsafe_store! (Base. unsafe_convert (Ptr{T}, Base. data_pointer_from_objref (v)), val, i)
101+ unsafe_store! (Base. unsafe_convert (Ptr{T}, Base. data_pointer_from_objref (v)), convert (T, val) , i)
102102 else
103103 # This one is unsafe (#27)
104104 # unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(v.data)), Base.data_pointer_from_objref(val), i)
0 commit comments