Replace result_of by invoke_result for C++17 and above #1999 #2021
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #1999, std::result_of is deprecated in C++17 and should be replaced by std::invoke_result. In C++20, std::result_of is removed. What I do in this PR is performing this replacement, when using C++17 or C++20. I used almost the same as in this other PR, from another library fmtlib/fmt#1028.
I also make a minor modification to how std::result_of is use for C++11 and C++14, to comply with how it is recommended (https://en.cppreference.com/w/cpp/types/result_of):
I ran all tests with gcc7, gcc9 and VS2017 (with C++14, and C++latest).