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

Allow convertable types and forward values #340

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading