[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
Cr-Mirrored-From: https://chromium.googlesource.com/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: c98648a1759b453a2ae019f4fcc5e38128c4cd4a
diff --git a/include/functional b/include/functional
index 9d15485..3e94253 100644
--- a/include/functional
+++ b/include/functional
@@ -2338,14 +2338,14 @@
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 @@
};
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 @@
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 @@
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();