Coroutines¶
In namespace coroutines
:
Proto promises¶
#include<hysj/coroutines/proto_promise.hpp>
A proto-promse contains all the parameters needed by a coroutine-framework. It shall be the first parameter of the coroutine or member-coroutine.
-
template<typename ProtoPromise>
struct traits::return_object¶
-
template<typename ProtoPromise>
using return_object¶ - Specifies the type of the coroutine-return-object associated with the ProtoPromise.
-
template<typename ResumeType>
auto get_proto_promise(type_t<ResumeType>, auto &promise)¶ - A hook which returns a proto-promise for the given resume-type. promise is a reference to the promise of the current coroutine.
-
template<typename ReturnObject>
struct static_proto_promise¶ -
using return_object = ReturnObject¶
Helper for coroutine-frameworks do not need any parameters passed down.-
using return_object = ReturnObject¶
-
HYSJ_PROMISE(proto_promise_type)¶
- Returns an lvalue-reference to the coroutine-promise.
Yield¶
#include<hysj/coroutines/yield.hpp>
-
auto yield(auto &promise, auto&&... values)¶
Halt¶
#include<hysj/coroutines/halt.hpp>
-
auto halt(auto &promise, auto&&... values)¶
Bulitin¶
In namespace builtin
:
Trees¶
#include<hysj/coroutines/builtin/trees.hpp>
Coroutine framework for structured and synchronous coroutines.
-
template<typename Fruit>
struct trees::seed¶ - Proto-promise for a
trees::root
coroutine.
-
template<typename Fruit>
struct trees::root¶ - Return-object-type for the root of a coroutine-tree.
-
template<typename Fruit, typename Energy>
struct trees::sprout¶ - Proto-promise for a
trees::branch
coroutine.
-
template<typename Fruit, typename Energy>
struct trees::branch¶ - Return-object-type for a branch of a coroutine-tree.
-
template<typename Fruit>
struct trees::root_iterator¶ - Iterator-type for a coroutine-tree.
Generator¶
#include<hysj/coroutines/builtin/generator.hpp>
Stolen from P2168R0.
-
template<typename T>
struct generator¶