Convert parametric-type on the run

Hi everyone,
I have the following definition of types:

mutable struct TYPEA{L,Tv<:Number}
    K::Array{Tv,8}
end
TYPEA1{Tv} = TYPEA{:A1,Tv}
TYPEA2{Tv} = TYPEA{:A2,Tv}

and I define a variable

a = TYPEA1{ComplexF64}(rand(ComplexF64,2,2,2,2,2,2,2,2))

I want to convert the type of a the other type TYPEA2 and the variable a is abandoned thereafter. How can I do this without invoking a copy routine of a.K ? I don’t want to do that for efficiency reasons.

TYPEA2{Complex64}(a.K)?

2 Likes