Skip to content

Commit

Permalink
Change result_of to invoke_result in watchman/Result.h
Browse files Browse the repository at this point in the history
Summary: C++20 has [eliminated](https://en.cppreference.com/w/cpp/types/result_of) `result_of` in favour of `invoke_result`. It's mysterious that this code even still works, but, nevertheless, I'm fixing it.

Differential Revision: D56987484

fbshipit-source-id: e1e641424271e1164eee19be5726ec6abe0c1ffd
  • Loading branch information
r-barnes authored and facebook-github-bot committed May 6, 2024
1 parent 09c9ab6 commit 585107b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions watchman/Result.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ Result<typename std::decay<T>::type, Error> makeResult(T&& t) {
// This is the non-void return type flavor.
template <typename Func>
typename std::enable_if<
!std::is_same<typename std::result_of<Func()>::type, void>::value,
Result<typename std::result_of<Func()>::type>>::type
!std::is_same<typename std::invoke_result<Func>::type, void>::value,
Result<typename std::invoke_result<Func>::type>>::type
makeResultWith(Func&& func) {
using ResType = typename std::result_of<Func()>::type;
using ResType = typename std::invoke_result<Func>::type;

try {
return Result<ResType>(func());
Expand All @@ -286,7 +286,7 @@ makeResultWith(Func&& func) {
// This is the void return type flavor; it produces Result<Unit>
template <typename Func>
typename std::enable_if<
std::is_same<typename std::result_of<Func()>::type, void>::value,
std::is_same<typename std::invoke_result<Func>::type, void>::value,
Result<folly::Unit>>::type
makeResultWith(Func&& func) {
try {
Expand Down

0 comments on commit 585107b

Please sign in to comment.