I'm trying to define a type which has two fields, the first of which can be
either real or complex and the second is always complex.
type RealorComplex{T<:Number}
v::Vector{T}
w::Vector{Complex{T}}
end
r = RealorComplex([1.0, 2.0], [1.0+1.0im, 2.0])
t = RealorComplex([1.0+1.0im, 2.0], [1.0+1.0im, 2.0])
The construction of r is totally fine but not that of t, since mismatch of
the type. What is the best way to fix my ctor so that it can take either
type of first argument .
Hope I have made my question clear. Thanks.