Coroutines ========== .. cpp:namespace:: hysj::coroutines In namespace :cpp:any:`coroutines`: Proto promises -------------- :cpp:include:`#include` A proto-promse contains all the parameters needed by a coroutine-framework. It shall be the first parameter of the coroutine or member-coroutine. .. cpp:struct:: template traits::return_object .. cpp:type:: template return_object | Specifies the type of the coroutine-return-object associated with the :cpp:expr:`ProtoPromise`. | .. cpp:function:: template auto get_proto_promise(type_t,auto &promise) | A hook which returns a proto-promise for the given resume-type. :cpp:expr:`promise` is a reference to the promise of the current coroutine. | .. cpp:struct:: template static_proto_promise .. cpp:type:: return_object = ReturnObject | Helper for coroutine-frameworks do not need any parameters passed down. | .. c:macro:: HYSJ_PROMISE(proto_promise_type) | Returns an lvalue-reference to the coroutine-promise. | Yield ----- :cpp:include:`#include` .. cpp:function:: auto yield(auto &promise,auto &&... values) Halt ---- :cpp:include:`#include` .. cpp:function:: auto halt(auto &promise,auto &&... values) Bulitin ------- .. cpp:namespace-push:: builtin In namespace :cpp:any:`builtin`: Trees ^^^^^ :cpp:include:`#include` Coroutine framework for structured and synchronous coroutines. .. cpp:struct:: template trees::seed | Proto-promise for a :cpp:type:`trees::root` coroutine. | .. cpp:struct:: template trees::root | Return-object-type for the root of a coroutine-tree. | .. cpp:struct:: template trees::sprout | Proto-promise for a :cpp:type:`trees::branch` coroutine. | .. cpp:struct:: template trees::branch | Return-object-type for a branch of a coroutine-tree. | .. cpp:struct:: template trees::root_iterator | Iterator-type for a coroutine-tree. | .. cpp:type:: template co_seed = trees::seed template co_root = trees::root template co_sprout = trees::sprout template co_branch = trees::branch | Ergonomic type-aliases. | Generator ^^^^^^^^^ :cpp:include:`#include` Stolen from `P2168R0 `_. .. cpp:struct:: template generator .. cpp:namespace-pop::