Remove absl::result_of_t in C++20
This PR removes absl::result_of_t when compiling for C++20. I did the dead-simplest thing: I just added #if guards everywhere it is used.
Alternatives that spring to mind:
- Provide a drop in replacement for result_of_t in C++20. I have some commented out code to this effect.
- Provide an implementation of invoke_result_t in C++14 and earlier, port everything in the library to use this.
Something appears to be wrong with your .clang-format file. It doesn't appear to produce the same results as the formatting that is actually in these files.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.
What to do if you already signed the CLA
Individual signers
- It's possible we don't have your GitHub username or you're using a different email address on your commit. Check your existing CLA data and verify that your email is set on your git commits.
Corporate signers
- Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the Google project maintainer to go/cla#troubleshoot (Public version).
- The email used to register you as an authorized contributor must be the email used for the Git commit. Check your existing CLA data and verify that your email is set on your git commits.
- The email used to register you as an authorized contributor must also be attached to your GitHub account.
ℹ️ Googlers: Go here for more info.
@googlebot I signed it!
I think this is worth fixing but I would prefer to use a different approach.
Abseil already has an internal version of invoke_result_t: absl::base_internal::InvokeT. If we use that instead, we can have identical behavior across standard versions.
This change has gotten me to revisit our internal Invoker class. I am working on bringing it up to adapt the new INVOKE() behavior introduced in C++17, and will make absl::base_internal::Invoke and InvokeT be aliases to std::invoke and std::invoke_result_t when those are available.
Just to touch base with you, I have not lost track of this CL. My initial attempt to correct this involved improving our absl::base_internal::Invoke to provide C++17 INVOKE semantics (unpacking reference_wrappers), but the larger template metaprogramming involved caused our internal compiler memory usage to use too much memory.
My second attempt will be to make Invoke and InvokeT be aliases to std::invoke and std::invoke_result_t in C++17 builds. If this works, and doesn't break our compiles, I can continue down my original planned path.
In any event, I will ultimately replace all uses of result_of with base_internal::InvokeT, whatever form that takes. It shouldn't be too long now.
Getting a bunch of these errors in MSVC. What's the status of this PR?
Still active, or want me to make suggested changes in a new PR?
@obsgolem @vslashg