[libcxx-commits] [libcxx] c98648a - [NFC] Add _EnableIfLValueCallable and move reference out of __callable.

via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 19 17:16:20 PDT 2020


Author: zoecarver
Date: 2020-05-19T17:15:28-07:00
New Revision: c98648a1759b453a2ae019f4fcc5e38128c4cd4a

URL: https://github.com/llvm/llvm-project/commit/c98648a1759b453a2ae019f4fcc5e38128c4cd4a
DIFF: https://github.com/llvm/llvm-project/commit/c98648a1759b453a2ae019f4fcc5e38128c4cd4a.diff

LOG:     [NFC] Add _EnableIfLValueCallable and move reference out of __callable.

    Summary: In std::functional moves the reference out of the `__callable` implementation and replaces `_EnableIfCallable` with `_EnableIfLValueCallable` (`_EnableIfLValueCallable` passes `__callable` an lvalue reference type).

    Reviewers: ldionne, #libc!

    Subscribers: dexonsmith, libcxx-commits

    Tags: #libc

    Differential Revision: https://reviews.llvm.org/D80071

Added: 
    

Modified: 
    libcxx/include/functional

Removed: 
    


################################################################################
diff  --git a/libcxx/include/functional b/libcxx/include/functional
index 9d1548583930..3e9425320fc3 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -2338,14 +2338,14 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
 
     template <class _Fp, bool = _And<
         _IsNotSame<__uncvref_t<_Fp>, function>,
-        __invokable<_Fp&, _ArgTypes...>
+        __invokable<_Fp, _ArgTypes...>
     >::value>
     struct __callable;
     template <class _Fp>
         struct __callable<_Fp, true>
         {
             static const bool value = is_same<void, _Rp>::value ||
-                is_convertible<typename __invoke_of<_Fp&, _ArgTypes...>::type,
+                is_convertible<typename __invoke_of<_Fp, _ArgTypes...>::type,
                                _Rp>::value;
         };
     template <class _Fp>
@@ -2355,7 +2355,7 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
         };
 
   template <class _Fp>
-  using _EnableIfCallable = typename enable_if<__callable<_Fp>::value>::type;
+  using _EnableIfLValueCallable = typename enable_if<__callable<_Fp&>::value>::type;
 public:
     typedef _Rp result_type;
 
@@ -2366,7 +2366,7 @@ public:
     function(nullptr_t) _NOEXCEPT {}
     function(const function&);
     function(function&&) _NOEXCEPT;
-    template<class _Fp, class = _EnableIfCallable<_Fp>>
+    template<class _Fp, class = _EnableIfLValueCallable<_Fp>>
     function(_Fp);
 
 #if _LIBCPP_STD_VER <= 14
@@ -2380,14 +2380,14 @@ public:
       function(allocator_arg_t, const _Alloc&, const function&);
     template<class _Alloc>
       function(allocator_arg_t, const _Alloc&, function&&);
-    template<class _Fp, class _Alloc, class = _EnableIfCallable<_Fp>>
+    template<class _Fp, class _Alloc, class = _EnableIfLValueCallable<_Fp>>
       function(allocator_arg_t, const _Alloc& __a, _Fp __f);
 #endif
 
     function& operator=(const function&);
     function& operator=(function&&) _NOEXCEPT;
     function& operator=(nullptr_t) _NOEXCEPT;
-    template<class _Fp, class = _EnableIfCallable<typename decay<_Fp>::type>>
+    template<class _Fp, class = _EnableIfLValueCallable<typename decay<_Fp>::type>>
     function& operator=(_Fp&&);
 
     ~function();


        


More information about the libcxx-commits mailing list