[libc++] Use std::is_nothrow_callable for std::invoke according to LWG 2807
Thanks to Zoe Carver for the patch.
Differential Revision: https://reviews.llvm.org/D58097
llvm-svn: 357616
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 6c49e1ce2610171add0132d678981d18d7702d84
diff --git a/include/functional b/include/functional
index def8a75..2cec0ea 100644
--- a/include/functional
+++ b/include/functional
@@ -230,6 +230,10 @@
template<class R, class Fn, class... BoundArgs>
unspecified bind(Fn&&, BoundArgs&&...);
+template<class F, class... Args>
+ invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) // C++17
+ noexcept(is_nothrow_invocable_v<F, Args...>);
+
namespace placeholders {
// M is the implementation-defined number of placeholders
extern unspecified _1;
@@ -2769,9 +2773,9 @@
#if _LIBCPP_STD_VER > 14
template <class _Fn, class ..._Args>
-result_of_t<_Fn&&(_Args&&...)>
+invoke_result_t<_Fn, _Args...>
invoke(_Fn&& __f, _Args&&... __args)
- noexcept(noexcept(_VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...)))
+ noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
{
return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
}