functional (321369) | functional (326496) |
---|---|
1// -*- C++ -*- 2//===------------------------ functional ----------------------------------===// 3// 4// The LLVM Compiler Infrastructure 5// 6// This file is dual licensed under the MIT and the University of Illinois Open 7// Source Licenses. See LICENSE.TXT for details. 8// --- 1583 unchanged lines hidden (view full) --- 1592 typedef __function::__base<_Rp(_ArgTypes...)> __base; 1593 typename aligned_storage<3*sizeof(void*)>::type __buf_; 1594 __base* __f_; 1595 1596 _LIBCPP_NO_CFI static __base *__as_base(void *p) { 1597 return reinterpret_cast<__base*>(p); 1598 } 1599 | 1// -*- C++ -*- 2//===------------------------ functional ----------------------------------===// 3// 4// The LLVM Compiler Infrastructure 5// 6// This file is dual licensed under the MIT and the University of Illinois Open 7// Source Licenses. See LICENSE.TXT for details. 8// --- 1583 unchanged lines hidden (view full) --- 1592 typedef __function::__base<_Rp(_ArgTypes...)> __base; 1593 typename aligned_storage<3*sizeof(void*)>::type __buf_; 1594 __base* __f_; 1595 1596 _LIBCPP_NO_CFI static __base *__as_base(void *p) { 1597 return reinterpret_cast<__base*>(p); 1598 } 1599 |
1600 template <class _Fp, bool = !is_same<_Fp, function>::value && 1601 __invokable<_Fp&, _ArgTypes...>::value> 1602 struct __callable; | 1600 template <class _Fp, bool = __lazy_and< 1601 integral_constant<bool, !is_same<__uncvref_t<_Fp>, function>::value>, 1602 __invokable<_Fp&, _ArgTypes...> 1603 >::value> 1604 struct __callable; |
1603 template <class _Fp> 1604 struct __callable<_Fp, true> 1605 { 1606 static const bool value = is_same<void, _Rp>::value || 1607 is_convertible<typename __invoke_of<_Fp&, _ArgTypes...>::type, 1608 _Rp>::value; 1609 }; 1610 template <class _Fp> 1611 struct __callable<_Fp, false> 1612 { 1613 static const bool value = false; 1614 }; | 1605 template <class _Fp> 1606 struct __callable<_Fp, true> 1607 { 1608 static const bool value = is_same<void, _Rp>::value || 1609 is_convertible<typename __invoke_of<_Fp&, _ArgTypes...>::type, 1610 _Rp>::value; 1611 }; 1612 template <class _Fp> 1613 struct __callable<_Fp, false> 1614 { 1615 static const bool value = false; 1616 }; |
1617 1618 template <class _Fp> 1619 using _EnableIfCallable = typename enable_if<__callable<_Fp>::value>::type; |
|
1615public: 1616 typedef _Rp result_type; 1617 1618 // construct/copy/destroy: 1619 _LIBCPP_INLINE_VISIBILITY 1620 function() _NOEXCEPT : __f_(0) {} 1621 _LIBCPP_INLINE_VISIBILITY 1622 function(nullptr_t) _NOEXCEPT : __f_(0) {} 1623 function(const function&); 1624 function(function&&) _NOEXCEPT; | 1620public: 1621 typedef _Rp result_type; 1622 1623 // construct/copy/destroy: 1624 _LIBCPP_INLINE_VISIBILITY 1625 function() _NOEXCEPT : __f_(0) {} 1626 _LIBCPP_INLINE_VISIBILITY 1627 function(nullptr_t) _NOEXCEPT : __f_(0) {} 1628 function(const function&); 1629 function(function&&) _NOEXCEPT; |
1625 template<class _Fp, class = typename enable_if< 1626 __callable<_Fp>::value && !is_same<_Fp, function>::value 1627 >::type> | 1630 template<class _Fp, class = _EnableIfCallable<_Fp>> |
1628 function(_Fp); 1629 1630#if _LIBCPP_STD_VER <= 14 1631 template<class _Alloc> 1632 _LIBCPP_INLINE_VISIBILITY 1633 function(allocator_arg_t, const _Alloc&) _NOEXCEPT : __f_(0) {} 1634 template<class _Alloc> 1635 _LIBCPP_INLINE_VISIBILITY 1636 function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT : __f_(0) {} 1637 template<class _Alloc> 1638 function(allocator_arg_t, const _Alloc&, const function&); 1639 template<class _Alloc> 1640 function(allocator_arg_t, const _Alloc&, function&&); | 1631 function(_Fp); 1632 1633#if _LIBCPP_STD_VER <= 14 1634 template<class _Alloc> 1635 _LIBCPP_INLINE_VISIBILITY 1636 function(allocator_arg_t, const _Alloc&) _NOEXCEPT : __f_(0) {} 1637 template<class _Alloc> 1638 _LIBCPP_INLINE_VISIBILITY 1639 function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT : __f_(0) {} 1640 template<class _Alloc> 1641 function(allocator_arg_t, const _Alloc&, const function&); 1642 template<class _Alloc> 1643 function(allocator_arg_t, const _Alloc&, function&&); |
1641 template<class _Fp, class _Alloc, class = typename enable_if<__callable<_Fp>::value>::type> | 1644 template<class _Fp, class _Alloc, class = _EnableIfCallable<_Fp>> |
1642 function(allocator_arg_t, const _Alloc& __a, _Fp __f); 1643#endif 1644 1645 function& operator=(const function&); 1646 function& operator=(function&&) _NOEXCEPT; 1647 function& operator=(nullptr_t) _NOEXCEPT; | 1645 function(allocator_arg_t, const _Alloc& __a, _Fp __f); 1646#endif 1647 1648 function& operator=(const function&); 1649 function& operator=(function&&) _NOEXCEPT; 1650 function& operator=(nullptr_t) _NOEXCEPT; |
1648 template 1649 typename enable_if 1650 < 1651 __callable<typename decay<_Fp>::type>::value && 1652 !is_same<typename remove_reference<_Fp>::type, function>::value, 1653 function& 1654 >::type 1655 operator=(_Fp&&); | 1651 template<class _Fp, class = _EnableIfCallable<_Fp>> 1652 function& operator=(_Fp&&); |
1656 1657 ~function(); 1658 1659 // function modifiers: 1660 void swap(function&) _NOEXCEPT; 1661 1662#if _LIBCPP_STD_VER <= 14 1663 template<class _Fp, class _Alloc> --- 185 unchanged lines hidden (view full) --- 1849 __f_->destroy(); 1850 else if (__f_) 1851 __f_->destroy_deallocate(); 1852 __f_ = 0; 1853 return *this; 1854} 1855 1856template<class _Rp, class ..._ArgTypes> | 1653 1654 ~function(); 1655 1656 // function modifiers: 1657 void swap(function&) _NOEXCEPT; 1658 1659#if _LIBCPP_STD_VER <= 14 1660 template<class _Fp, class _Alloc> --- 185 unchanged lines hidden (view full) --- 1846 __f_->destroy(); 1847 else if (__f_) 1848 __f_->destroy_deallocate(); 1849 __f_ = 0; 1850 return *this; 1851} 1852 1853template<class _Rp, class ..._ArgTypes> |
1857template 1858typename enable_if 1859< 1860 function<_Rp(_ArgTypes...)>::template __callable<typename decay<_Fp>::type>::value && 1861 !is_same<typename remove_reference<_Fp>::type, function<_Rp(_ArgTypes...)>>::value, 1862 function<_Rp(_ArgTypes...)>& 1863>::type | 1854template <class _Fp, class> 1855function<_Rp(_ArgTypes...)>& |
1864function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f) 1865{ 1866 function(_VSTD::forward<_Fp>(__f)).swap(*this); 1867 return *this; 1868} 1869 1870template<class _Rp, class ..._ArgTypes> 1871function<_Rp(_ArgTypes...)>::~function() --- 553 unchanged lines hidden --- | 1856function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f) 1857{ 1858 function(_VSTD::forward<_Fp>(__f)).swap(*this); 1859 return *this; 1860} 1861 1862template<class _Rp, class ..._ArgTypes> 1863function<_Rp(_ArgTypes...)>::~function() --- 553 unchanged lines hidden --- |