diff --git a/libcxx/include/__algorithm/iterator_operations.h b/libcxx/include/__algorithm/iterator_operations.h --- a/libcxx/include/__algorithm/iterator_operations.h +++ b/libcxx/include/__algorithm/iterator_operations.h @@ -110,27 +110,23 @@ } // iter_move - template + template >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static // If the result of dereferencing `_Iter` is a reference type, deduce the result of calling `std::move` on it. Note // that the C++03 mode doesn't support `decltype(auto)` as the return type. - __enable_if_t< - is_reference<__deref_t<_Iter> >::value, - __move_t<_Iter> > + __move_t<_Iter> __iter_move(_Iter&& __i) { __validate_iter_reference<_Iter>(); return std::move(*std::forward<_Iter>(__i)); } - template + template >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static // If the result of dereferencing `_Iter` is a value type, deduce the return value of this function to also be a // value -- otherwise, after `operator*` returns a temporary, this function would return a dangling reference to that // temporary. Note that the C++03 mode doesn't support `auto` as the return type. - __enable_if_t< - !is_reference<__deref_t<_Iter> >::value, - __deref_t<_Iter> > + __deref_t<_Iter> __iter_move(_Iter&& __i) { __validate_iter_reference<_Iter>(); diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h --- a/libcxx/include/__algorithm/sort.h +++ b/libcxx/include/__algorithm/sort.h @@ -175,23 +175,26 @@ *__y = __r ? *__y : __tmp; } -template -inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void> +template ::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI void __sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _Compare __c) { std::__cond_swap<_Compare>(__x2, __x3, __c); std::__partially_sorted_swap<_Compare>(__x1, __x2, __x3, __c); } -template -inline _LIBCPP_HIDE_FROM_ABI __enable_if_t::value, void> +template ::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI void __sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _Compare __c) { std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c); } -template -inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void> +template ::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI void __sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _RandomAccessIterator __x4, _Compare __c) { std::__cond_swap<_Compare>(__x1, __x3, __c); @@ -201,15 +204,17 @@ std::__cond_swap<_Compare>(__x2, __x3, __c); } -template -inline _LIBCPP_HIDE_FROM_ABI __enable_if_t::value, void> +template ::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI void __sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _RandomAccessIterator __x4, _Compare __c) { std::__sort4<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __c); } -template -inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void> +template ::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI void __sort5_maybe_branchless( _RandomAccessIterator __x1, _RandomAccessIterator __x2, @@ -225,8 +230,9 @@ std::__partially_sorted_swap<_Compare>(__x2, __x3, __x4, __c); } -template -inline _LIBCPP_HIDE_FROM_ABI __enable_if_t::value, void> +template ::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI void __sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _RandomAccessIterator __x4, _RandomAccessIterator __x5, _Compare __c) { std::__sort5<_AlgPolicy, _Compare, _RandomAccessIterator>( diff --git a/libcxx/include/__condition_variable/condition_variable.h b/libcxx/include/__condition_variable/condition_variable.h --- a/libcxx/include/__condition_variable/condition_variable.h +++ b/libcxx/include/__condition_variable/condition_variable.h @@ -92,9 +92,8 @@ }; #endif // !_LIBCPP_HAS_NO_THREADS -template -inline _LIBCPP_HIDE_FROM_ABI __enable_if_t::value, chrono::nanoseconds> -__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { +template ::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { using namespace chrono; using __ratio = ratio_divide<_Period, nano>; using __ns_rep = nanoseconds::rep; @@ -113,9 +112,8 @@ return nanoseconds(static_cast<__ns_rep>(__result_float)); } -template -inline _LIBCPP_HIDE_FROM_ABI __enable_if_t::value, chrono::nanoseconds> -__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { +template ::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI chrono::nanoseconds __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { using namespace chrono; if (__d.count() == 0) { return nanoseconds(0); diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h --- a/libcxx/include/__functional/bind.h +++ b/libcxx/include/__functional/bind.h @@ -98,13 +98,9 @@ return __ti(_VSTD::forward<_Uj>(_VSTD::get<_Indx>(__uj))...); } -template +template ::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 -typename __enable_if_t -< - is_bind_expression<_Ti>::value, - __invoke_of<_Ti&, _Uj...> ->::type +typename __invoke_of<_Ti&, _Uj...>::type __mu(_Ti& __ti, tuple<_Uj...>& __uj) { typedef typename __make_tuple_indices::type __indices; diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -194,16 +194,16 @@ return __v.first; } - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - static __enable_if_t<__is_same_uncvref<_Up, __node_value_type>::value, __container_value_type const&> + static __container_value_type const& __get_value(_Up& __t) { return __t.__get_value(); } - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, __container_value_type const&> + static __container_value_type const& __get_value(_Up& __t) { return __t; } @@ -904,9 +904,10 @@ __can_extract_key<_Pp, key_type>()); } - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, pair > + pair __emplace_unique(_First&& __f, _Second&& __s) { return __emplace_unique_key_args(__f, _VSTD::forward<_First>(__f), _VSTD::forward<_Second>(__s)); diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer --- a/libcxx/include/__split_buffer +++ b/libcxx/include/__split_buffer @@ -160,15 +160,13 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x); - template + template ::value, int> = 0> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value> - __construct_at_end(_InputIter __first, _InputIter __last); + void __construct_at_end(_InputIter __first, _InputIter __last); - template + template ::value, int> = 0> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value> - __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); + void __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); template _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI @@ -283,9 +281,9 @@ } template -template -_LIBCPP_CONSTEXPR_SINCE_CXX20 __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value> -__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last) +template ::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 +void __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last) { __construct_at_end_with_sentinel(__first, __last); } @@ -312,9 +310,9 @@ } } template -template -_LIBCPP_CONSTEXPR_SINCE_CXX20 __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value> -__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) +template ::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 +void __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) { __construct_at_end_with_size(__first, std::distance(__first, __last)); } diff --git a/libcxx/include/__tree b/libcxx/include/__tree --- a/libcxx/include/__tree +++ b/libcxx/include/__tree @@ -615,9 +615,9 @@ return __t.__get_value().first; } - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, key_type const&> + static key_type const& __get_key(_Up& __t) { return __t.first; } @@ -1186,9 +1186,10 @@ __can_extract_key<_Pp, key_type>()); } - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, pair > + pair __emplace_unique(_First&& __f, _Second&& __s) { return __emplace_unique_key_args(__f, _VSTD::forward<_First>(__f), _VSTD::forward<_Second>(__s)); @@ -1228,9 +1229,10 @@ __can_extract_key<_Pp, key_type>()); } - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, iterator> + iterator __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) { return __emplace_hint_unique_key_args(__p, __f, _VSTD::forward<_First>(__f), diff --git a/libcxx/include/array b/libcxx/include/array --- a/libcxx/include/array +++ b/libcxx/include/array @@ -444,9 +444,9 @@ #endif // _LIBCPP_STD_VER <= 17 -template +template ::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t<_Size == 0 || __is_swappable<_Tp>::value, void> +void swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y) _NOEXCEPT_(noexcept(__x.swap(__y))) { diff --git a/libcxx/include/cmath b/libcxx/include/cmath --- a/libcxx/include/cmath +++ b/libcxx/include/cmath @@ -642,10 +642,9 @@ return __builtin_copysignl(__x, __y); } -template +template ::value && std::is_arithmetic<_A2>::value, int> = 0> _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI - typename std::__enable_if_t::value && std::is_arithmetic<_A2>::value, - std::__promote<_A1, _A2> >::type + typename __promote<_A1, _A2>::type __constexpr_copysign(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -777,8 +777,8 @@ // ~forward_list() = default; - template - __enable_if_t<__has_input_iterator_category<_InputIterator>::value, void> + template ::value, int> = 0> + void _LIBCPP_HIDE_FROM_ABI assign(_InputIterator __f, _InputIterator __l); #if _LIBCPP_STD_VER >= 23 @@ -872,9 +872,9 @@ #endif // _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, const value_type& __v); _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, size_type __n, const value_type& __v); - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__has_input_iterator_category<_InputIterator>::value, iterator> + iterator insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); #if _LIBCPP_STD_VER >= 23 @@ -1170,8 +1170,8 @@ #endif // _LIBCPP_CXX03_LANG template -template -__enable_if_t<__has_input_iterator_category<_InputIterator>::value, void> +template ::value, int> > +void forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) { __assign_with_sentinel(__f, __l); @@ -1376,8 +1376,8 @@ } template -template -__enable_if_t<__has_input_iterator_category<_InputIterator>::value, typename forward_list<_Tp, _Alloc>::iterator> +template ::value, int> > +typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l) { diff --git a/libcxx/include/map b/libcxx/include/map --- a/libcxx/include/map +++ b/libcxx/include/map @@ -1530,13 +1530,13 @@ _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __tree_.find(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> + iterator find(const _K2& __k) {return __tree_.find(__k);} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator> + const_iterator find(const _K2& __k) const {return __tree_.find(__k);} #endif @@ -1544,18 +1544,18 @@ size_type count(const key_type& __k) const {return __tree_.__count_unique(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, size_type> + size_type count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif #if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, bool> + bool contains(const _K2& __k) const { return find(__k) != end(); } #endif // _LIBCPP_STD_VER >= 20 @@ -1566,14 +1566,14 @@ const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> + iterator lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator> + const_iterator lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} #endif @@ -1584,13 +1584,13 @@ const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> + iterator upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator> + const_iterator upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} #endif @@ -1601,13 +1601,13 @@ pair equal_range(const key_type& __k) const {return __tree_.__equal_range_unique(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, pair> + pair equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, pair> + pair equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} #endif @@ -2266,13 +2266,13 @@ _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __tree_.find(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> + iterator find(const _K2& __k) {return __tree_.find(__k);} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator> + const_iterator find(const _K2& __k) const {return __tree_.find(__k);} #endif @@ -2280,18 +2280,18 @@ size_type count(const key_type& __k) const {return __tree_.__count_multi(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, size_type> + size_type count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif #if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, bool> + bool contains(const _K2& __k) const { return find(__k) != end(); } #endif // _LIBCPP_STD_VER >= 20 @@ -2302,14 +2302,14 @@ const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> + iterator lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator> + const_iterator lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} #endif @@ -2320,13 +2320,13 @@ const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> + iterator upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator> + const_iterator upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} #endif @@ -2337,13 +2337,13 @@ pair equal_range(const key_type& __k) const {return __tree_.__equal_range_multi(__k);} #if _LIBCPP_STD_VER >= 14 - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, pair> + pair equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} - template + template ::value, int> = 0> _LIBCPP_INLINE_VISIBILITY - __enable_if_t<__is_transparent<_Compare, _K2>::value, pair> + pair equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} #endif diff --git a/libcxx/include/queue b/libcxx/include/queue --- a/libcxx/include/queue +++ b/libcxx/include/queue @@ -565,9 +565,9 @@ #endif -template +template ::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY -__enable_if_t<__is_swappable<_Container>::value, void> +void swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { @@ -1108,12 +1108,10 @@ swap(comp, __q.comp); } -template +template ::value && __is_swappable<_Compare>::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY -__enable_if_t< - __is_swappable<_Container>::value && __is_swappable<_Compare>::value, - void -> +void swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) diff --git a/libcxx/include/stack b/libcxx/include/stack --- a/libcxx/include/stack +++ b/libcxx/include/stack @@ -414,9 +414,9 @@ #endif -template +template ::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY -__enable_if_t<__is_swappable<_Container>::value, void> +void swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { diff --git a/libcxx/include/tuple b/libcxx/include/tuple --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -1367,9 +1367,9 @@ tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>; #endif -template +template ::value...>::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t<__all<__is_swappable<_Tp>::value...>::value, void> +void swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__t.swap(__u);}