Skip to content

Issue with default values on arrays #1207

Closed Answered by Robadob
daniele-baccega asked this question in Q&A
Discussion options

You must be logged in to vote

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 a std::array.

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);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by daniele-baccega
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants