[libcxx-commits] [libcxx] 4887d04 - [libc++][NFC] Replace enable_if with __enable_if_t in a few places
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 4 02:09:40 PDT 2022
Author: Nikolas Klauser
Date: 2022-07-04T11:09:34+02:00
New Revision: 4887d047a31fa89735f36ae03b697abbbd71f0dc
URL: https://github.com/llvm/llvm-project/commit/4887d047a31fa89735f36ae03b697abbbd71f0dc
DIFF: https://github.com/llvm/llvm-project/commit/4887d047a31fa89735f36ae03b697abbbd71f0dc.diff
LOG: [libc++][NFC] Replace enable_if with __enable_if_t in a few places
Reviewed By: ldionne, #libc
Spies: jloser, libcxx-commits
Differential Revision: https://reviews.llvm.org/D128400
Added:
Modified:
libcxx/include/__hash_table
libcxx/include/__mutex_base
libcxx/include/__split_buffer
libcxx/include/__tree
libcxx/include/__tuple
libcxx/include/array
libcxx/include/exception
libcxx/include/forward_list
libcxx/include/list
libcxx/include/map
libcxx/include/tuple
libcxx/include/unordered_map
Removed:
################################################################################
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 20223014432fd..036b0dcadc714 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -178,16 +178,14 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- static typename enable_if<__is_same_uncvref<_Up, __node_value_type>::value,
- __container_value_type const&>::type
+ static __enable_if_t<__is_same_uncvref<_Up, __node_value_type>::value, __container_value_type const&>
__get_value(_Up& __t) {
return __t.__get_value();
}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value,
- __container_value_type const&>::type
+ static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, __container_value_type const&>
__get_value(_Up& __t) {
return __t;
}
@@ -1049,10 +1047,8 @@ public:
template <class _First, class _Second>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<
- __can_extract_map_key<_First, key_type, __container_value_type>::value,
- pair<iterator, bool>
- >::type __emplace_unique(_First&& __f, _Second&& __s) {
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, pair<iterator, bool> >
+ __emplace_unique(_First&& __f, _Second&& __s) {
return __emplace_unique_key_args(__f, _VSTD::forward<_First>(__f),
_VSTD::forward<_Second>(__s));
}
@@ -1096,9 +1092,7 @@ public:
return __emplace_unique_key_args(_NodeTypes::__get_key(__x), _VSTD::move(__x));
}
- template <class _Pp, class = typename enable_if<
- !__is_same_uncvref<_Pp, __container_value_type>::value
- >::type>
+ template <class _Pp, class = __enable_if_t<!__is_same_uncvref<_Pp, __container_value_type>::value> >
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> __insert_unique(_Pp&& __x) {
return __emplace_unique(_VSTD::forward<_Pp>(__x));
diff --git a/libcxx/include/__mutex_base b/libcxx/include/__mutex_base
index da056b6d14237..ac0d090b7d194 100644
--- a/libcxx/include/__mutex_base
+++ b/libcxx/include/__mutex_base
@@ -338,11 +338,7 @@ private:
template <class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_floating_point<_Rep>::value,
- chrono::nanoseconds
->::type
+__enable_if_t<is_floating_point<_Rep>::value, chrono::nanoseconds>
__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
{
using namespace chrono;
@@ -365,11 +361,7 @@ __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
template <class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_floating_point<_Rep>::value,
- chrono::nanoseconds
->::type
+__enable_if_t<!is_floating_point<_Rep>::value, chrono::nanoseconds>
__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
{
using namespace chrono;
diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer
index e484e70440c9a..c1c03dd741b0f 100644
--- a/libcxx/include/__split_buffer
+++ b/libcxx/include/__split_buffer
@@ -118,19 +118,10 @@ public:
void __construct_at_end(size_type __n);
void __construct_at_end(size_type __n, const_reference __x);
template <class _InputIter>
- typename enable_if
- <
- __is_cpp17_input_iterator<_InputIter>::value &&
- !__is_cpp17_forward_iterator<_InputIter>::value,
- void
- >::type
+ __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value && !__is_cpp17_forward_iterator<_InputIter>::value>
__construct_at_end(_InputIter __first, _InputIter __last);
template <class _ForwardIterator>
- typename enable_if
- <
- __is_cpp17_forward_iterator<_ForwardIterator>::value,
- void
- >::type
+ __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value>
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
@@ -239,12 +230,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
template <class _Tp, class _Allocator>
template <class _InputIter>
-typename enable_if
-<
- __is_cpp17_input_iterator<_InputIter>::value &&
- !__is_cpp17_forward_iterator<_InputIter>::value,
- void
->::type
+__enable_if_t<__is_cpp17_input_iterator<_InputIter>::value && !__is_cpp17_forward_iterator<_InputIter>::value>
__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
{
__alloc_rr& __a = this->__alloc();
@@ -267,11 +253,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt
template <class _Tp, class _Allocator>
template <class _ForwardIterator>
-typename enable_if
-<
- __is_cpp17_forward_iterator<_ForwardIterator>::value,
- void
->::type
+__enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value>
__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
{
_ConstructTransaction __tx(&this->__end_, _VSTD::distance(__first, __last));
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index e5dd1f4d45ea9..8d8449706871f 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -597,8 +597,7 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value,
- key_type const&>::type
+ static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, key_type const&>
__get_key(_Up& __t) {
return __t.first;
}
@@ -611,8 +610,7 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value,
- __container_value_type const&>::type
+ static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, __container_value_type const&>
__get_value(_Up& __t) {
return __t;
}
@@ -1175,10 +1173,8 @@ public:
template <class _First, class _Second>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<
- __can_extract_map_key<_First, key_type, __container_value_type>::value,
- pair<iterator, bool>
- >::type __emplace_unique(_First&& __f, _Second&& __s) {
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, pair<iterator, bool> >
+ __emplace_unique(_First&& __f, _Second&& __s) {
return __emplace_unique_key_args(__f, _VSTD::forward<_First>(__f),
_VSTD::forward<_Second>(__s));
}
@@ -1219,10 +1215,8 @@ public:
template <class _First, class _Second>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<
- __can_extract_map_key<_First, key_type, __container_value_type>::value,
- iterator
- >::type __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, iterator>
+ __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
return __emplace_hint_unique_key_args(__p, __f,
_VSTD::forward<_First>(__f),
_VSTD::forward<_Second>(__s)).first;
@@ -1275,21 +1269,15 @@ public:
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), _VSTD::move(__v)).first;
}
- template <class _Vp, class = typename enable_if<
- !is_same<typename __unconstref<_Vp>::type,
- __container_value_type
- >::value
- >::type>
+ template <class _Vp,
+ class = __enable_if_t<!is_same<typename __unconstref<_Vp>::type, __container_value_type>::value> >
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> __insert_unique(_Vp&& __v) {
return __emplace_unique(_VSTD::forward<_Vp>(__v));
}
- template <class _Vp, class = typename enable_if<
- !is_same<typename __unconstref<_Vp>::type,
- __container_value_type
- >::value
- >::type>
+ template <class _Vp,
+ class = __enable_if_t<!is_same<typename __unconstref<_Vp>::type, __container_value_type>::value> >
_LIBCPP_INLINE_VISIBILITY
iterator __insert_unique(const_iterator __p, _Vp&& __v) {
return __emplace_hint_unique(__p, _VSTD::forward<_Vp>(__v));
diff --git a/libcxx/include/__tuple b/libcxx/include/__tuple
index 6d13bb24c5795..f85036e7af1db 100644
--- a/libcxx/include/__tuple
+++ b/libcxx/include/__tuple
@@ -30,14 +30,14 @@ using __enable_if_tuple_size_imp = _Tp;
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
const _Tp,
- typename enable_if<!is_volatile<_Tp>::value>::type,
+ __enable_if_t<!is_volatile<_Tp>::value>,
integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
volatile _Tp,
- typename enable_if<!is_const<_Tp>::value>::type,
+ __enable_if_t<!is_const<_Tp>::value>,
integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
@@ -393,7 +393,7 @@ struct __tuple_sfinae_base {
template <template <class, class...> class _Trait,
class ..._LArgs, class ..._RArgs>
static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>)
- -> __all<typename enable_if<_Trait<_LArgs, _RArgs>::value, bool>::type{true}...>;
+ -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>;
template <template <class...> class>
static auto __do_test(...) -> false_type;
diff --git a/libcxx/include/array b/libcxx/include/array
index e96c3d8133393..867dd6b1bcc6b 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -438,12 +438,7 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-typename enable_if
-<
- _Size == 0 ||
- __is_swappable<_Tp>::value,
- void
->::type
+__enable_if_t<_Size == 0 || __is_swappable<_Tp>::value, void>
swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y)
_NOEXCEPT_(noexcept(__x.swap(__y)))
{
diff --git a/libcxx/include/exception b/libcxx/include/exception
index 412e02af38227..955739e49ecaa 100644
--- a/libcxx/include/exception
+++ b/libcxx/include/exception
@@ -310,7 +310,7 @@ template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
rethrow_if_nested(const _Ep& __e,
- typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
+ __enable_if_t< __can_dynamic_cast<_Ep, nested_exception>::value>* = 0)
{
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
if (__nep)
@@ -321,7 +321,7 @@ template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
rethrow_if_nested(const _Ep&,
- typename enable_if<!__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
+ __enable_if_t<!__can_dynamic_cast<_Ep, nested_exception>::value>* = 0)
{
}
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 6a72720273513..aab3b8715d014 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -703,15 +703,11 @@ public:
template <class _InputIterator>
forward_list(_InputIterator __f, _InputIterator __l,
- typename enable_if<
- __is_cpp17_input_iterator<_InputIterator>::value
- >::type* = nullptr);
+ __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>* = nullptr);
template <class _InputIterator>
forward_list(_InputIterator __f, _InputIterator __l,
const allocator_type& __a,
- typename enable_if<
- __is_cpp17_input_iterator<_InputIterator>::value
- >::type* = nullptr);
+ __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>* = nullptr);
forward_list(const forward_list& __x);
forward_list(const forward_list& __x, const __type_identity_t<allocator_type>& __a);
@@ -743,11 +739,7 @@ public:
// ~forward_list() = default;
template <class _InputIterator>
- typename enable_if
- <
- __is_cpp17_input_iterator<_InputIterator>::value,
- void
- >::type
+ __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>
assign(_InputIterator __f, _InputIterator __l);
void assign(size_type __n, const value_type& __v);
@@ -823,12 +815,8 @@ public:
iterator insert_after(const_iterator __p, const value_type& __v);
iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if
- <
- __is_cpp17_input_iterator<_InputIterator>::value,
- iterator
- >::type
+ _LIBCPP_INLINE_VISIBILITY
+ __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, iterator>
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
iterator erase_after(const_iterator __p);
@@ -977,9 +965,7 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
template <class _Tp, class _Alloc>
template <class _InputIterator>
forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
- typename enable_if<
- __is_cpp17_input_iterator<_InputIterator>::value
- >::type*)
+ __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>*)
{
insert_after(cbefore_begin(), __f, __l);
}
@@ -988,9 +974,7 @@ template <class _Tp, class _Alloc>
template <class _InputIterator>
forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
const allocator_type& __a,
- typename enable_if<
- __is_cpp17_input_iterator<_InputIterator>::value
- >::type*)
+ __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>*)
: base(__a)
{
insert_after(cbefore_begin(), __f, __l);
@@ -1100,11 +1084,7 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
template <class _Tp, class _Alloc>
template <class _InputIterator>
-typename enable_if
-<
- __is_cpp17_input_iterator<_InputIterator>::value,
- void
->::type
+__enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
{
iterator __i = before_begin();
@@ -1296,11 +1276,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
template <class _Tp, class _Alloc>
template <class _InputIterator>
-typename enable_if
-<
- __is_cpp17_input_iterator<_InputIterator>::value,
- typename forward_list<_Tp, _Alloc>::iterator
->::type
+__enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, typename forward_list<_Tp, _Alloc>::iterator>
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
_InputIterator __f, _InputIterator __l)
{
diff --git a/libcxx/include/list b/libcxx/include/list
index d75b15c060be8..1db29d14b8420 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -870,10 +870,10 @@ public:
template <class _InpIter>
list(_InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
+ __enable_if_t<__is_cpp17_input_iterator<_InpIter>::value>* = 0);
template <class _InpIter>
list(_InpIter __f, _InpIter __l, const allocator_type& __a,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
+ __enable_if_t<__is_cpp17_input_iterator<_InpIter>::value>* = 0);
list(const list& __c);
list(const list& __c, const __type_identity_t<allocator_type>& __a);
@@ -905,7 +905,7 @@ public:
template <class _InpIter>
void assign(_InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
+ __enable_if_t<__is_cpp17_input_iterator<_InpIter>::value>* = 0);
void assign(size_type __n, const value_type& __x);
_LIBCPP_INLINE_VISIBILITY
@@ -1022,7 +1022,7 @@ public:
iterator insert(const_iterator __p, size_type __n, const value_type& __x);
template <class _InpIter>
iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
+ __enable_if_t<__is_cpp17_input_iterator<_InpIter>::value>* = 0);
_LIBCPP_INLINE_VISIBILITY
void swap(list& __c)
@@ -1220,7 +1220,7 @@ list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
template <class _Tp, class _Alloc>
template <class _InpIter>
list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
+ __enable_if_t<__is_cpp17_input_iterator<_InpIter>::value>*)
{
_VSTD::__debug_db_insert_c(this);
for (; __f != __l; ++__f)
@@ -1230,7 +1230,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
template <class _Tp, class _Alloc>
template <class _InpIter>
list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
+ __enable_if_t<__is_cpp17_input_iterator<_InpIter>::value>*)
: base(__a)
{
_VSTD::__debug_db_insert_c(this);
@@ -1355,7 +1355,7 @@ template <class _Tp, class _Alloc>
template <class _InpIter>
void
list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
+ __enable_if_t<__is_cpp17_input_iterator<_InpIter>::value>*)
{
iterator __i = begin();
iterator __e = end();
@@ -1460,7 +1460,7 @@ template <class _Tp, class _Alloc>
template <class _InpIter>
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
+ __enable_if_t<__is_cpp17_input_iterator<_InpIter>::value>*)
{
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
"list::insert(iterator, range) called with an iterator not referring to this list");
diff --git a/libcxx/include/map b/libcxx/include/map
index 106ed5259ed96..14f9a2773b73d 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -792,9 +792,7 @@ public:
}
template <class _ValueTp,
- class = typename enable_if<
- __is_same_uncvref<_ValueTp, value_type>::value
- >::type
+ class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value>
>
_LIBCPP_INLINE_VISIBILITY
__value_type& operator=(_ValueTp&& __v)
@@ -1230,13 +1228,13 @@ public:
}
template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+ class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_Pp&& __p)
{return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));}
template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+ class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _Pp&& __p)
{return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));}
@@ -1456,11 +1454,11 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator>
find(const _K2& __k) {return __tree_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator>
find(const _K2& __k) const {return __tree_.find(__k);}
#endif
@@ -1470,7 +1468,7 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, size_type>
count(const _K2& __k) const {return __tree_.__count_multi(__k);}
#endif
@@ -1479,7 +1477,7 @@ public:
bool contains(const key_type& __k) const {return find(__k) != end();}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, bool>
contains(const _K2& __k) const { return find(__k) != end(); }
#endif // _LIBCPP_STD_VER > 17
@@ -1492,12 +1490,12 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator>
lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator>
lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
#endif
@@ -1510,11 +1508,11 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator>
upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator>
upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
#endif
@@ -1527,11 +1525,11 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, pair<iterator,iterator>>
equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, pair<const_iterator,const_iterator>>
equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
#endif
@@ -2000,13 +1998,13 @@ public:
}
template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+ class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
_LIBCPP_INLINE_VISIBILITY
iterator insert(_Pp&& __p)
{return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));}
template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+ class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _Pp&& __p)
{return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));}
@@ -2128,11 +2126,11 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator>
find(const _K2& __k) {return __tree_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator>
find(const _K2& __k) const {return __tree_.find(__k);}
#endif
@@ -2142,7 +2140,7 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, size_type>
count(const _K2& __k) const {return __tree_.__count_multi(__k);}
#endif
@@ -2151,7 +2149,7 @@ public:
bool contains(const key_type& __k) const {return find(__k) != end();}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, bool>
contains(const _K2& __k) const { return find(__k) != end(); }
#endif // _LIBCPP_STD_VER > 17
@@ -2164,12 +2162,12 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator>
lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator>
lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
#endif
@@ -2182,11 +2180,11 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator>
upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, const_iterator>
upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
#endif
@@ -2199,11 +2197,11 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, pair<iterator,iterator>>
equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
+ __enable_if_t<__is_transparent<_Compare, _K2>::value, pair<const_iterator,const_iterator>>
equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
#endif
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 221eb23dd3f8d..79527cca58539 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -482,10 +482,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp.
{}
template <class _Tuple,
- class = typename enable_if
- <
- __tuple_constructible<_Tuple, tuple<_Tp...> >::value
- >::type
+ class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value>
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
__tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
@@ -495,10 +492,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp.
{}
template <class _Alloc, class _Tuple,
- class = typename enable_if
- <
- __tuple_constructible<_Tuple, tuple<_Tp...> >::value
- >::type
+ class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value>
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
__tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
@@ -1336,11 +1330,7 @@ tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>;
template <class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-typename enable_if
-<
- __all<__is_swappable<_Tp>::value...>::value,
- void
->::type
+__enable_if_t<__all<__is_swappable<_Tp>::value...>::value, void>
swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
_NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
{__t.swap(__u);}
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 72749e11e843c..7767805f38c61 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -876,9 +876,7 @@ public:
}
template <class _ValueTp,
- class = typename enable_if<
- __is_same_uncvref<_ValueTp, value_type>::value
- >::type
+ class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value>
>
_LIBCPP_INLINE_VISIBILITY
__hash_value_type& operator=(_ValueTp&& __v)
@@ -1237,13 +1235,13 @@ public:
}
template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+ class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_Pp&& __x)
{return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));}
template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+ class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, _Pp&& __x)
{
@@ -2114,13 +2112,13 @@ public:
{return __table_.__insert_multi(__p.__i_, _VSTD::move(__x));}
template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+ class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
_LIBCPP_INLINE_VISIBILITY
iterator insert(_Pp&& __x)
{return __table_.__insert_multi(_VSTD::forward<_Pp>(__x));}
template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
+ class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, _Pp&& __x)
{return __table_.__insert_multi(__p.__i_, _VSTD::forward<_Pp>(__x));}
More information about the libcxx-commits
mailing list