fix: debug error when std::option value_or is used.

The recently introduced vector definition using std::optional::value_or

    std::vector<double> values = value_data.value_or(*values_data);

leads to the following fatal error during debugging:

/usr/include/c++/15.2.1/optional:1179: constexpr const _Tp& std::optional<_Tp>::operator*() const & [with _Tp = std::vector<double>]: Assertion 'this->_M_is_engaged()' failed.

The reason is: if values_data is disengaged, *values_data triggers the std::optional debug-mode assertion.

This MR fixes the error by replacing the vector definition with the following safe ternary operator:

    std::vector<double> values =
        value_data ? *value_data
                   : (values_data ? *values_data : std::vector<double>{});
  • TODO: provide short description of the changes.
  1. Feature description was added to the changelog
  2. Tests covering your feature were added?
  3. Any new feature or behaviour change was documented?
Edited by wenqing

Merge request reports

Loading