fiber
Loading...
Searching...
No Matches
cAwaitable.hpp
Go to the documentation of this file.
1#pragma once
2
3// std
4#include <concepts>
5#include <coroutine>
6
7namespace fiber
8{
9
10 // forward declaration
11 template<class T>
12 class CoroutinePromise;
13
22 template<class Awaitable, class ResultType = void>
23 concept cAwaitable = requires(Awaitable awaitable){
24 { awaitable.await_ready() } -> std::convertible_to<bool>;
25 { awaitable.await_resume() } -> std::same_as<ResultType>;
26 } && (
27 requires(Awaitable awaitable, std::coroutine_handle<CoroutinePromise<int/*any type*/>> handle){
28 { awaitable.await_suspend(handle) } -> std::same_as<void>;
29 }
30 ||
31 requires(Awaitable awaitable, std::coroutine_handle<CoroutinePromise<int/*any type*/>> handle){
32 { awaitable.await_suspend(handle) } -> std::same_as<bool>;
33 }
34 );
35
36} // namespace fiber
Promise type for an fiber::Coroutine.
Definition Coroutine.hpp:750
Concept describeing the interface of an object that can be co_awaited.
Definition cAwaitable.hpp:23
Definition Duration.hpp:17