[libcxx-commits] [PATCH] D99041: [libcxx] moves `std::invoke` into `__functional_base`

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 21 12:52:09 PDT 2021


cjdb updated this revision to Diff 332174.
cjdb retitled this revision from "[libcxx] moves `std::invoke` into its own header" to "[libcxx] moves `std::invoke` into `__functional_base`".
cjdb edited the summary of this revision.
cjdb added a comment.

applies @Quuxplusone's point about `__functional_base`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99041/new/

https://reviews.llvm.org/D99041

Files:
  libcxx/include/__functional_base
  libcxx/include/concepts
  libcxx/include/functional


Index: libcxx/include/functional
===================================================================
--- libcxx/include/functional
+++ libcxx/include/functional
@@ -2984,14 +2984,6 @@
 
 #if _LIBCPP_STD_VER > 14
 
-template <class _Fn, class ..._Args>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...>
-invoke(_Fn&& __f, _Args&&... __args)
-    noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
-{
-    return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
-}
-
 template<class _Op, class _Tuple,
          class _Idxs = typename __make_tuple_indices<tuple_size<_Tuple>::value>::type>
 struct __perfect_forward_impl;
Index: libcxx/include/concepts
===================================================================
--- libcxx/include/concepts
+++ libcxx/include/concepts
@@ -135,7 +135,7 @@
 */
 
 #include <__config>
-#include <functional>
+#include <__functional_base>
 #include <type_traits>
 #include <utility>
 #include <version>
Index: libcxx/include/__functional_base
===================================================================
--- libcxx/include/__functional_base
+++ libcxx/include/__functional_base
@@ -665,6 +665,18 @@
 
 #endif  // _LIBCPP_CXX03_LANG
 
+#if _LIBCPP_STD_VER > 14
+
+template <class _Fn, class ..._Args>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...>
+invoke(_Fn&& __f, _Args&&... __args)
+    noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
+{
+    return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
+}
+
+#endif // _LIBCPP_STD_VER > 14
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif  // _LIBCPP_FUNCTIONAL_BASE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99041.332174.patch
Type: text/x-patch
Size: 1629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210321/63161662/attachment.bin>


More information about the libcxx-commits mailing list