Hi,
is it possible to do such a thing?
struct MM{T}
x::T
end
#when I do this
MM{Int}
#I want it to return
MM{Float64}
I tried the following but didn’t work:
function (::Base.Type{Type{MM}})(::Type{Int})
MM{Float64}
end
Hi,
is it possible to do such a thing?
struct MM{T}
x::T
end
#when I do this
MM{Int}
#I want it to return
MM{Float64}
I tried the following but didn’t work:
function (::Base.Type{Type{MM}})(::Type{Int})
MM{Float64}
end
No. Why?
like that ?
struct MM{T}
x::T
end
MM(x::Int) = MM(float(x))
julia> MM(1)
MM{Float64}(1.0)