I can’t work out how to specify default values for a struct array that is nested. I have one struct a_t
which specifies default values. I have a MVector of type a_t
in the struct b_t
. The following code fails. I want the MVector b2
of type a_t
to take the default values already specified. (Note that if I did not have a vector, e.g. b2::a_t = a_t()
, then that works as expected.)
using StaticArrays
using Parameters
@with_kw mutable struct a_t
a1::Int64 = 10
a2::Float64 = 0.0
end
@with_kw mutable struct b_t
b1::Float64 = 0.0
b2::MVector{2, a_t} .= a_t()
end