I have an abstract type,
abstract type AT end
and two mutable struct
s that are subtypes of AT
:
mutable struct S1 <: AT
#something
end
mutable struct S2 <: AT
#something
end
I would like to define a function that takes as argument vectors that can contain either S1
s or S2
s or both. I had hoped that the following would work:
function fnc(v::Vector{AT})
#something
end
However, it turns out that it works only if the vector contains both S1
s and S2
s. If, for instance, the argument is a Vector{S1}
the function throws an error. I’m sure there is a simple solution but I can’t think of it. Help would be much appreciated.