aboutsummaryrefslogtreecommitdiff
path: root/include/functional
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-02 12:47:11 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-02 12:47:11 +0000
commitdbabdb5220c44e5938d404eefb84b5ed55667ea8 (patch)
tree75c7e5204ae0564ac641b1629ef74066461d1884 /include/functional
parent8a86acebf859efb1adc46c88fa0cd69381a7291f (diff)
downloadsrc-dbabdb5220c44e5938d404eefb84b5ed55667ea8.tar.gz
src-dbabdb5220c44e5938d404eefb84b5ed55667ea8.zip
Notes
Notes: svn path=/vendor/libc++/dist/; revision=326465 svn path=/vendor/libc++/libc++-release_501-r320880/; revision=326904; tag=vendor/libc++/libc++-release_501-r320880
Diffstat (limited to 'include/functional')
-rw-r--r--include/functional36
1 files changed, 14 insertions, 22 deletions
diff --git a/include/functional b/include/functional
index 83a2e5a39a88..f73c3ca56a8e 100644
--- a/include/functional
+++ b/include/functional
@@ -1597,9 +1597,11 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
return reinterpret_cast<__base*>(p);
}
- template <class _Fp, bool = !is_same<_Fp, function>::value &&
- __invokable<_Fp&, _ArgTypes...>::value>
- struct __callable;
+ template <class _Fp, bool = __lazy_and<
+ integral_constant<bool, !is_same<__uncvref_t<_Fp>, function>::value>,
+ __invokable<_Fp&, _ArgTypes...>
+ >::value>
+ struct __callable;
template <class _Fp>
struct __callable<_Fp, true>
{
@@ -1612,6 +1614,9 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
{
static const bool value = false;
};
+
+ template <class _Fp>
+ using _EnableIfCallable = typename enable_if<__callable<_Fp>::value>::type;
public:
typedef _Rp result_type;
@@ -1622,9 +1627,7 @@ public:
function(nullptr_t) _NOEXCEPT : __f_(0) {}
function(const function&);
function(function&&) _NOEXCEPT;
- template<class _Fp, class = typename enable_if<
- __callable<_Fp>::value && !is_same<_Fp, function>::value
- >::type>
+ template<class _Fp, class = _EnableIfCallable<_Fp>>
function(_Fp);
#if _LIBCPP_STD_VER <= 14
@@ -1638,21 +1641,15 @@ 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 = typename enable_if<__callable<_Fp>::value>::type>
+ template<class _Fp, class _Alloc, class = _EnableIfCallable<_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>
- typename enable_if
- <
- __callable<typename decay<_Fp>::type>::value &&
- !is_same<typename remove_reference<_Fp>::type, function>::value,
- function&
- >::type
- operator=(_Fp&&);
+ template<class _Fp, class = _EnableIfCallable<_Fp>>
+ function& operator=(_Fp&&);
~function();
@@ -1854,13 +1851,8 @@ function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
}
template<class _Rp, class ..._ArgTypes>
-template <class _Fp>
-typename enable_if
-<
- function<_Rp(_ArgTypes...)>::template __callable<typename decay<_Fp>::type>::value &&
- !is_same<typename remove_reference<_Fp>::type, function<_Rp(_ArgTypes...)>>::value,
- function<_Rp(_ArgTypes...)>&
->::type
+template <class _Fp, class>
+function<_Rp(_ArgTypes...)>&
function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f)
{
function(_VSTD::forward<_Fp>(__f)).swap(*this);