[pstl] Fix incorrect usage of std::invoke_result

std::invoke_result takes function object type and arguments separately
(unlike std::result_of) so, std::invoke_result_t<F()> usage is
incorrect.

On the other hand, we don't need std::invoke() semantics here at all. So
just simplifying the code without extra dependency and use trailing
return type as the fix.

Reviewed By: MikeDvorskiy

Differential Revision: https://reviews.llvm.org/D114624
This commit is contained in:
Ruslan Arutyunyan 2021-11-26 16:37:31 +03:00
parent 30238c3676
commit f824bb0e36
1 changed files with 4 additions and 4 deletions

View File

@ -63,15 +63,15 @@ void __invoke_if_not(std::true_type, _Fp)
}
template <typename _F1, typename _F2>
typename std::invoke_result<_F1()>::type
__invoke_if_else(std::true_type, _F1 __f1, _F2)
auto
__invoke_if_else(std::true_type, _F1 __f1, _F2) -> decltype(__f1())
{
return __f1();
}
template <typename _F1, typename _F2>
typename std::invoke_result<_F2()>::type
__invoke_if_else(std::false_type, _F1, _F2 __f2)
auto
__invoke_if_else(std::false_type, _F1, _F2 __f2) -> decltype(__f2())
{
return __f2();
}