boostorg / boostorg/leaf

[Feature] Support for C++20 coroutines

Open
#11 17 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
339
Forks
55
PR merge metrics
No merged PRs in 30d

Description

To use this library with C++20 coroutine the call in `handle_error.hpp` - `try_handle_all` or `try_handle_some`:

`if( auto r = std::forward(try_block)() )`

Should check whether the returned time is an Awaitable and use

`if( auto r = co_await std::forward(try_block)() )`

instead. Similarly for the error handling functions. This would allow users to write code among the lines of:

```c++
boost:leaf::try_handle_some(
[]() -> boost::asio::awaitable> {
co_return boost::leaf::result{};
}, ...);
```

which is currently not possible. Maybe we could even achieve less verbosity. Ideally I would want to write `co_return {};` just like before, but I think ` boost::leaf::result<>` would need a constructor that takes an `initializer_list` then.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.