Closed
Description
MWE:
struct T1{T}
m::T
end
struct T2{L}
tuple::NTuple{3, Int}
function T2{L}(t::NTuple{3, Int}) where {L}
new{sum(t)}(t)
end
end
struct T3{L, N}
a::Tuple{T2{L}}
param::NTuple{N, T1}
function T3(a::Tuple{T2{L}}, pars::NTuple{N, T1}) where {L, N}
new{L, N}(a, pars)
end
end
function f(ts)
pars = []
for t in ts
append!(pars, t.param)
end
pars
end
t1_1 = ((T1{Float64}(1.0), T1{Int}(2)))
t1_2 = ((T1{Float64}(1.2), T1{Int}(1)))
t2_1 = (T2{1}((1,0,0)),)
t2_2 = (T2{2}((2,0,0)),)
[T3(t2_1, t1_1), T3(t2_2, t1_2)] |> f
Original Discourse discussion is here.