-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(common): g::c::future
support for coroutines
#8532
Conversation
Integrate `google::cloud::future<T>` with C++20 coroutines. This feature is optional, and only enabled if the compiler supports C++20. Because some C++20 compilers disable coroutines by default, this feature is disabled if `__cpp_impl_coroutine` is not defined, or it is 0.
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Codecov Report
@@ Coverage Diff @@
## main #8532 +/- ##
==========================================
- Coverage 93.92% 93.92% -0.01%
==========================================
Files 1453 1453
Lines 125889 125889
==========================================
- Hits 118247 118239 -8
- Misses 7642 7650 +8
Continue to review full report at Codecov.
|
I think the new code is cleaner too, so there is that.
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm new to C++20, but from what I can tell this LGTM.
|
||
/// Specialize `std::coroutine_traits` for `google::cloud::future<T>`. | ||
template <typename T, typename... Args> | ||
requires(!std::is_void_v<T> && !std::is_reference_v<T>) /**/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is /**/
intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, clang-format
does a poor job with these otherwise.
Integrate
google::cloud::future<T>
with C++20 coroutines. Thisfeature is optional, and only enabled if the compiler supports C++20.
Because some C++20 compilers disable coroutines by default, this feature
is disabled if
__cpp_impl_coroutine
is not defined, or it is 0.I verified our C++20 build actually tests these features.
This change is