Issue with default values on arrays #1207
-
Hi, But in this way only the first element is initialized to -1, all the other elements to 0. is there a way to initialize an array in a simple way at definition time? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's a much larger array that we ever really expected to be used for agent variables. The I don't think aggregate init permits what you want to do, so you would need to do something like std::array<int, 100000> defaultArr;
defaultArr.fill(-1); // https://en.cppreference.com/w/cpp/container/array/fill
pedestrian.newVariable<int, 100000>(FLOW, defaultArr); |
Beta Was this translation helpful? Give feedback.
That's a much larger array that we ever really expected to be used for agent variables.
The
newVariable()
expects the default to be passed as astd::array
.I don't think aggregate init permits what you want to do, so you would need to do something like