struct my_struct{A <: Function,B <: Function}
a::A
b::B
end
I would like to write a function func that accepts an OrderedDict which values are Tuples of an unknown amount of my_structs. I tried typing its arguments:
function func(od::OrderedDict{Any,Tuple{Vararg{my_struct{<:Function, <:Function }}}})
# do stuff
od
end
maybe just don’t type it? Your keys are Any anyway.
The reason your current code doesn’t work I suspect is because Vararg requires all the args same type, my_struct_1 and my_struct_2 has different types
Could you (or someone) please explain (or refer me to an explanation of) why this works while directly tipying the arguments like the initial post doesn’t? I tried to read the docs but I couldn’t find the answer.
Sorry for the insistence, but then why does ::Dict{<:Any, <:Tuple{Vararg{my_struct}}} work and ::Dict{Any,Tuple{Vararg{my_struct}}} doesn’t? What does the <: do besides specifying that there should be a subtype of what is on the right?