Skip to content

Commit f81e316

Browse files
committed
use similar_type instead of special-casing to SArray and MArray
1 parent 390f5c4 commit f81e316

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/convert.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,5 @@ length_val(a::Type{T}) where {T<:StaticArrayLike} = length_val(Size(T))
4949
end
5050

5151
# `float` and `real` of StaticArray types, analogously to application to scalars (issue 935)
52-
for SAT in (:SArray, :MArray)
53-
@eval begin
54-
float(::Type{$SAT{S,T,N,L}}) where {S,T,N,L} = $SAT{S,float(T),N,L}
55-
real(::Type{$SAT{S,T,N,L}}) where {S,T,N,L} = $SAT{S,real(T),N,L}
56-
end
57-
end
52+
float(::Type{SA}) where SA<:StaticArray{_S,T,_N} where {_S,T,_N} = similar_type(SA, float(T))
53+
real(::Type{SA}) where SA<:StaticArray{_S,T,_N} where {_S,T,_N} = similar_type(SA, real(T))

0 commit comments

Comments
 (0)