Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/Non-intuitive behavior of vector with non-empty initialization #22

Closed
alexanderscheible opened this issue Oct 4, 2024 · 1 comment · Fixed by #23
Closed

Issue/Non-intuitive behavior of vector with non-empty initialization #22

alexanderscheible opened this issue Oct 4, 2024 · 1 comment · Fixed by #23

Comments

@alexanderscheible
Copy link

alexanderscheible commented Oct 4, 2024

There seems to be an issue/non-intuitive behavior when defining an optional parameter vector with non-empty default values, e.g., like in

Params.hpp

struct Params {
  std::vector<double> weights {0.8, 0.2};
  using traits = figcone::FieldTraits<figcone::OptionalField<&Params::weights>>;
};

When I do not provide special values for weights, everything is fine, but when I specify the weights, the default weights are not removed, but the special values are appended.

Params.yaml

Params:
  weights: [5, 6]

This will result in weights == {0.8, 0.2, 5, 6}

@kamchatka-volcano
Copy link
Owner

Hi, thanks for creating this issue. This behavior was definitely unintended; not sure how it slipped through the test cases.
The fix is trivial, so I’ve already released it in v3.2.0. Please update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants