Dear all,
Can you help me to clarify some point?
Suppose, I have two composite types, one of them is parametric. They look rather similar.
using StaticArrays
struct test1
t::SVector{5,AbstractFloat}
end
struct test2{T<:AbstractFloat}
t::SVector{5,T}
end
The constructor test1 can convert a vector to a static vector while making the object.
test1([1.0:5.0…])
test1(AbstractFloat[1.0, 2.0, 3.0, 4.0, 5.0])
test2 can’t
test2([1.0:5.0…])
ERROR: MethodError: no method matching test2(::Array{Float64,1})
Closest candidates are:
test2(::SArray{Tuple{5},T<:AbstractFloat,1,5}) where T<:AbstractFloat at REPL[4]:2.
What is the cause of this difference?