I have a problem where I have a struct of parametrically typed functions contained in another struct - to make user selected functions available and type stable. This is fine for one set of functions, but I need N sets of functions! and all type stable. This is the naive approach, which doesn’t work unless all sets of functions are identical:
struct FunctionSet{A,B,C}
func_a::A
func_b::B
func_c::C
end
struct SomeStruct{N,A,B,C}
function_sets::NTuple{N,FunctionSet{A,B,C}}
end
Any ideas on how to achieve this for multiple varying FunctionSets? Is this possible?
struct SomeStruct{N,T<:NTuple{N,FunctionSet}}
function_sets::T
end
(::Type{SomeStruct})(a::NTuple{N,FunctionSet}) where {N} = SomeStruct{N,typeof(a)}(a)