diff --git a/include/continuable/continuable-coroutine.hpp b/include/continuable/continuable-coroutine.hpp index 364ad03..e10742a 100644 --- a/include/continuable/continuable-coroutine.hpp +++ b/include/continuable/continuable-coroutine.hpp @@ -51,12 +51,12 @@ namespace std { namespace experimental { template struct coroutine_traits< - cti::continuable_base>, + cti::continuable_base>, FunctionArgs...> { using promise_type = - cti::detail::awaiting::promise_type, Args...>; + cti::detail::awaiting::promise_type, + cti::promise, Args...>; }; } // namespace experimental } // namespace std diff --git a/include/continuable/detail/other/coroutines.hpp b/include/continuable/detail/other/coroutines.hpp index ba200c3..f0260a6 100644 --- a/include/continuable/detail/other/coroutines.hpp +++ b/include/continuable/detail/other/coroutines.hpp @@ -150,38 +150,39 @@ struct handle_takeover { /// The type which is passed to the compiler that describes the properties /// of a continuable_base used as coroutine promise type. -template +template struct promise_type; /// Implements the resolving method return_void and return_value accordingly template struct promise_resolver_base; -template -struct promise_resolver_base> { +template +struct promise_resolver_base> { void return_void() { - auto me = static_cast*>(this); + auto me = static_cast*>(this); me->promise_.set_value(); } }; -template -struct promise_resolver_base> { +template +struct promise_resolver_base> { void return_value(T value) { - auto me = static_cast*>(this); + auto me = static_cast*>(this); me->promise_.set_value(std::move(value)); } }; -template -struct promise_resolver_base> { +template +struct promise_resolver_base> { template void return_value(T&& tuple_like) { - auto me = static_cast*>(this); + auto me = static_cast*>(this); traits::unpack(std::move(me->promise_), std::forward(tuple_like)); } }; -template -struct promise_type : promise_resolver_base> { +template +struct promise_type + : promise_resolver_base> { coroutine_handle<> handle_; Promise promise_; @@ -189,7 +190,7 @@ struct promise_type : promise_resolver_base> { explicit promise_type() : promise_(types::promise_no_init_arg_t{}) { } - auto get_return_object() { + Continuable get_return_object() { return [this](auto&& promise) { promise_ = std::forward(promise); handle_.resume();