diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp index 7ca16ed11..b64302fb2 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp @@ -656,11 +656,11 @@ class MainModelImpl, ComponentLis std::ranges::transform(do_update_cache, independence_flags.begin(), [](auto const& comp) { return comp.is_independent(); }); auto const scenario_sequence = [&all_scenario_sequence, ¤t_scenario_sequence_cache, - &independence_flags]() -> SequenceIdxView { + independence_flags_ = std::move(independence_flags)]() -> SequenceIdxView { return main_core::utils::run_functor_with_all_types_return_array( - [&all_scenario_sequence, ¤t_scenario_sequence_cache, &independence_flags]() { + [&all_scenario_sequence, ¤t_scenario_sequence_cache, &independence_flags_]() { constexpr auto comp_idx = main_core::utils::index_of_component; - if (std::get(independence_flags)) { + if (std::get(independence_flags_)) { return std::span{std::get(all_scenario_sequence)}; } return std::span{std::get(current_scenario_sequence_cache)};