More work on await

This commit is contained in:
Denis Blank 2017-11-13 18:23:04 +01:00
parent 6001e99723
commit a6b6148f44

View File

@ -49,12 +49,14 @@ using std::experimental::coroutine_handle;
/// An object which provides the internal buffer and helper methods /// An object which provides the internal buffer and helper methods
/// for waiting on a continuable in a stackless coroutine. /// for waiting on a continuable in a stackless coroutine.
template <typename Continuable> template <typename Continuable>
struct awaitable { class awaitable {
/// The continuable which is invoked upon suspension
Continuable continuable_; Continuable continuable_;
/// A cache which is used to pass the result of the continuation
/// to the
expected::expected<int /*TODO*/> cache_;
/// A cache which is used to public:
// expected::expected<int> cache_;
/// Since continuables are evaluated lazily we are not /// Since continuables are evaluated lazily we are not
/// capable to say whether the resumption will be instantly. /// capable to say whether the resumption will be instantly.
bool await_ready() const noexcept { bool await_ready() const noexcept {
@ -77,6 +79,7 @@ struct awaitable {
// return // return
} }
private:
/// Resolve the continuation through the result /// Resolve the continuation through the result
template <typename... Args> template <typename... Args>
void resolve(Args&&... args) { void resolve(Args&&... args) {