Skip to content

Commit

Permalink
Allow convertable types and forward values (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
Twon authored Oct 28, 2024
1 parent 8264b59 commit 080da79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libraries/core/src/morpheus/core/concurrency/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <morpheus/core/conformance/ranges.hpp>

#include <cassert>
#include <concepts>
#include <iterator>
#include <utility>

Expand Down Expand Up @@ -56,9 +57,10 @@ struct Generator

auto return_void() { return coro_ns::suspend_never{}; }

auto yield_value(const T value)
template<std::convertible_to<T> From>
auto yield_value(From&& from)
{
current_value = value;
current_value = std::forward<From>(from);
return coro_ns::suspend_always{};
}

Expand Down

0 comments on commit 080da79

Please sign in to comment.