Skip to content

Commit

Permalink
#136 work around broken ureact::merge with latest MSVC in c++20 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikTH committed Sep 10, 2023
1 parent f226dcb commit 45a0c85
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions include/ureact/adaptor/merge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,23 @@ class event_merge_node final : public event_stream_node<E>

UREACT_WARN_UNUSED_RESULT update_result update() override
{
const auto copy_events_from = [this]( const auto& src ) {
const auto& src_events = get_internals( src ).get_events();
this->get_events().insert( //
this->get_events().end(),
src_events.begin(),
src_events.end() );
};

std::apply(
[this](
const events<Values>&... sources ) { ( this->copy_events_from( sources ), ... ); },
[&copy_events_from](
const events<Values>&... sources ) { ( copy_events_from( sources ), ... ); },
m_sources );

return !this->get_events().empty() ? update_result::changed : update_result::unchanged;
}

private:
template <typename V>
void copy_events_from( const events<V>& src )
{
const auto& src_events = get_internals( src ).get_events();
this->get_events().insert( this->get_events().end(), src_events.begin(), src_events.end() );
}

std::tuple<events<Values>...> m_sources;
};

Expand Down

0 comments on commit 45a0c85

Please sign in to comment.