Probably not. Using a ref, or an array of a single element, are adequate solutions. Or using Setfield
. Here is a discussion on the alternatives: Mutable scalar in immutable object: the best alternative?
ps: Array{Virus,1}
is the same as Vector{Virus}
. Be careful that Virus
should be a concrete type here, or that vector would be abstract as well. If Virus
is abstract (has parameters, you should better parameterize the population struct as well for the type of Virus).