[libcxx-commits] [libcxx] 6256ccf - [libc++][NFC] Update the remaining enable_ifs
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Sep 1 17:51:24 PDT 2023
Author: Nikolas Klauser
Date: 2023-09-01T17:51:17-07:00
New Revision: 6256ccfd4f062f0b72b73adffe1dbf2c5b9903bb
URL: https://github.com/llvm/llvm-project/commit/6256ccfd4f062f0b72b73adffe1dbf2c5b9903bb
DIFF: https://github.com/llvm/llvm-project/commit/6256ccfd4f062f0b72b73adffe1dbf2c5b9903bb.diff
LOG: [libc++][NFC] Update the remaining enable_ifs
This brings most of the enable_ifs in libc++ to the same style.
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D157753
Added:
Modified:
libcxx/include/__charconv/from_chars_integral.h
libcxx/include/__charconv/to_chars_integral.h
libcxx/include/__filesystem/path.h
libcxx/include/__functional/bind.h
libcxx/include/__functional/function.h
libcxx/include/__functional/hash.h
libcxx/include/__memory/construct_at.h
libcxx/include/__memory/unique_ptr.h
libcxx/include/__type_traits/invoke.h
libcxx/include/__type_traits/is_swappable.h
libcxx/include/__utility/pair.h
libcxx/include/__utility/swap.h
libcxx/include/istream
libcxx/include/ostream
libcxx/include/regex
libcxx/include/scoped_allocator
Removed:
################################################################################
diff --git a/libcxx/include/__charconv/from_chars_integral.h b/libcxx/include/__charconv/from_chars_integral.h
index acfdf4b30da7bb..e969cedb33cbe4 100644
--- a/libcxx/include/__charconv/from_chars_integral.h
+++ b/libcxx/include/__charconv/from_chars_integral.h
@@ -124,7 +124,7 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts...
return __r;
}
-template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0>
+template <typename _Tp, __enable_if_t<is_unsigned<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) {
using __tx = __itoa::__traits<_Tp>;
@@ -145,7 +145,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value) {
});
}
-template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0>
+template <typename _Tp, __enable_if_t<is_signed<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) {
using __t = decltype(std::__to_unsigned_like(__value));
@@ -170,7 +170,7 @@ inline constexpr float __from_chars_log2f_lut[35] = {
4.321928, 4.3923173, 4.4594316, 4.523562, 4.5849624, 4.643856, 4.70044, 4.7548876, 4.807355,
4.857981, 4.9068904, 4.9541965, 5, 5.044394, 5.087463, 5.129283, 5.169925};
-template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0>
+template <typename _Tp, __enable_if_t<is_unsigned<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
__from_chars_integral(const char* __first, const char* __last, _Tp& __value, int __base) {
if (__base == 10)
@@ -211,20 +211,20 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value, int
__base);
}
-template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0>
+template <typename _Tp, __enable_if_t<is_signed<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
__from_chars_integral(const char* __first, const char* __last, _Tp& __value, int __base) {
using __t = decltype(std::__to_unsigned_like(__value));
return std::__sign_combinator(__first, __last, __value, __from_chars_integral<__t>, __base);
}
-template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
+template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
from_chars(const char* __first, const char* __last, _Tp& __value) {
return std::__from_chars_atoi(__first, __last, __value);
}
-template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
+template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
from_chars(const char* __first, const char* __last, _Tp& __value, int __base) {
_LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]");
diff --git a/libcxx/include/__charconv/to_chars_integral.h b/libcxx/include/__charconv/to_chars_integral.h
index 28fac7524cf360..f50cc55a4c6d90 100644
--- a/libcxx/include/__charconv/to_chars_integral.h
+++ b/libcxx/include/__charconv/to_chars_integral.h
@@ -222,23 +222,23 @@ struct _LIBCPP_HIDDEN __integral<16> {
} // namespace __itoa
-template <unsigned _Base, typename _Tp, typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0>
+template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) >= sizeof(unsigned)), int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value) {
return __itoa::__integral<_Base>::__width(__value);
}
-template <unsigned _Base, typename _Tp, typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0>
+template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) < sizeof(unsigned)), int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value) {
return std::__to_chars_integral_width<_Base>(static_cast<unsigned>(__value));
}
-template <unsigned _Base, typename _Tp, typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0>
+template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) >= sizeof(unsigned)), int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value) {
return __itoa::__integral<_Base>::__to_chars(__first, __last, __value);
}
-template <unsigned _Base, typename _Tp, typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0>
+template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) < sizeof(unsigned)), int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value) {
return std::__to_chars_integral<_Base>(__first, __last, static_cast<unsigned>(__value));
@@ -300,7 +300,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_
return {__last, errc(0)};
}
-template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
+template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
to_chars(char* __first, char* __last, _Tp __value) {
using _Type = __make_32_64_or_128_bit_t<_Tp>;
@@ -308,7 +308,7 @@ to_chars(char* __first, char* __last, _Tp __value) {
return std::__to_chars_itoa(__first, __last, static_cast<_Type>(__value), is_signed<_Tp>());
}
-template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
+template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
to_chars(char* __first, char* __last, _Tp __value, int __base) {
_LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]");
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index 0c234edf9eb9ce..c104b003573dc1 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -445,8 +445,7 @@ struct _PathExport<char8_t> {
class _LIBCPP_EXPORTED_FROM_ABI path {
template <class _SourceOrIter, class _Tp = path&>
- using _EnableIfPathable =
- typename enable_if<__is_pathable<_SourceOrIter>::value, _Tp>::type;
+ using _EnableIfPathable = __enable_if_t<__is_pathable<_SourceOrIter>::value, _Tp>;
template <class _Tp>
using _SourceChar = typename __is_pathable<_Tp>::__char_type;
diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index a37c6a1cb6faff..9ac920fa04fde3 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -265,12 +265,7 @@ class __bind : public __weak_result_type<__decay_t<_Fp> >
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
template <class _Gp, class ..._BA,
- class = typename enable_if
- <
- is_constructible<_Fd, _Gp>::value &&
- !is_same<__libcpp_remove_reference_t<_Gp>,
- __bind>::value
- >::type>
+ __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
: __f_(_VSTD::forward<_Gp>(__f)),
@@ -310,12 +305,7 @@ class __bind_r
template <class _Gp, class ..._BA,
- class = typename enable_if
- <
- is_constructible<_Fd, _Gp>::value &&
- !is_same<__libcpp_remove_reference_t<_Gp>,
- __bind_r>::value
- >::type>
+ __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind_r>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
: base(_VSTD::forward<_Gp>(__f),
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 3c6e3f450d8b1c..a5da3debcfbc4e 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -433,8 +433,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
}
}
- template <class _Fp,
- class = typename enable_if<!is_same<__decay_t<_Fp>, __value_func>::value>::type>
+ template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __value_func>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f)
: __value_func(_VSTD::forward<_Fp>(__f), allocator<_Fp>()) {}
@@ -778,7 +777,7 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
}
}
- template <class _Fp, class = typename enable_if<!is_same<__decay_t<_Fp>, __policy_func>::value>::type>
+ template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __policy_func>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY explicit __policy_func(_Fp&& __f)
: __policy_(__policy::__create_empty()) {
typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
@@ -1002,7 +1001,7 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
};
template <class _Fp>
- using _EnableIfLValueCallable = typename enable_if<__callable<_Fp&>::value>::type;
+ using _EnableIfLValueCallable = __enable_if_t<__callable<_Fp&>::value>;
public:
typedef _Rp result_type;
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index fa09748b145d60..87307f7f993449 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -673,7 +673,7 @@ using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type;
template <class _Type, class ..._Keys>
using __enable_hash_helper _LIBCPP_NODEBUG = __enable_hash_helper_imp<_Type,
- typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type
+ __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value>
>;
#else
template <class _Type, class ...>
diff --git a/libcxx/include/__memory/construct_at.h b/libcxx/include/__memory/construct_at.h
index a032c33b47a847..0b4a228f95fc9f 100644
--- a/libcxx/include/__memory/construct_at.h
+++ b/libcxx/include/__memory/construct_at.h
@@ -62,7 +62,7 @@ template <class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
_ForwardIterator __destroy(_ForwardIterator, _ForwardIterator);
-template <class _Tp, typename enable_if<!is_array<_Tp>::value, int>::type = 0>
+template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
void __destroy_at(_Tp* __loc) {
_LIBCPP_ASSERT_UNCATEGORIZED(__loc != nullptr, "null pointer given to destroy_at");
@@ -70,7 +70,7 @@ void __destroy_at(_Tp* __loc) {
}
#if _LIBCPP_STD_VER >= 20
-template <class _Tp, typename enable_if<is_array<_Tp>::value, int>::type = 0>
+template <class _Tp, __enable_if_t<is_array<_Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
void __destroy_at(_Tp* __loc) {
_LIBCPP_ASSERT_UNCATEGORIZED(__loc != nullptr, "null pointer given to destroy_at");
diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 6ce50f71482eb1..93a77b76dbd824 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -155,29 +155,29 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr {
template <bool _Dummy, class _Deleter = typename __dependent_type<
__type_identity<deleter_type>, _Dummy>::type>
using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
- typename enable_if<is_default_constructible<_Deleter>::value &&
- !is_pointer<_Deleter>::value>::type;
+ __enable_if_t<is_default_constructible<_Deleter>::value &&
+ !is_pointer<_Deleter>::value>;
template <class _ArgType>
using _EnableIfDeleterConstructible _LIBCPP_NODEBUG =
- typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
+ __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
template <class _UPtr, class _Up>
- using _EnableIfMoveConvertible _LIBCPP_NODEBUG = typename enable_if<
+ using _EnableIfMoveConvertible _LIBCPP_NODEBUG = __enable_if_t<
is_convertible<typename _UPtr::pointer, pointer>::value &&
!is_array<_Up>::value
- >::type;
+ >;
template <class _UDel>
- using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = typename enable_if<
+ using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = __enable_if_t<
(is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
(!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
- >::type;
+ >;
template <class _UDel>
- using _EnableIfDeleterAssignable = typename enable_if<
+ using _EnableIfDeleterAssignable = __enable_if_t<
is_assignable<_Dp&, _UDel&&>::value
- >::type;
+ >;
public:
template <bool _Dummy = true,
@@ -342,37 +342,37 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp>
template <bool _Dummy, class _Deleter = typename __dependent_type<
__type_identity<deleter_type>, _Dummy>::type>
using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
- typename enable_if<is_default_constructible<_Deleter>::value &&
- !is_pointer<_Deleter>::value>::type;
+ __enable_if_t<is_default_constructible<_Deleter>::value &&
+ !is_pointer<_Deleter>::value>;
template <class _ArgType>
using _EnableIfDeleterConstructible _LIBCPP_NODEBUG =
- typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
+ __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
template <class _Pp>
- using _EnableIfPointerConvertible _LIBCPP_NODEBUG = typename enable_if<
+ using _EnableIfPointerConvertible _LIBCPP_NODEBUG = __enable_if_t<
_CheckArrayPointerConversion<_Pp>::value
- >::type;
+ >;
template <class _UPtr, class _Up,
class _ElemT = typename _UPtr::element_type>
- using _EnableIfMoveConvertible _LIBCPP_NODEBUG = typename enable_if<
+ using _EnableIfMoveConvertible _LIBCPP_NODEBUG = __enable_if_t<
is_array<_Up>::value &&
is_same<pointer, element_type*>::value &&
is_same<typename _UPtr::pointer, _ElemT*>::value &&
is_convertible<_ElemT(*)[], element_type(*)[]>::value
- >::type;
+ >;
template <class _UDel>
- using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = typename enable_if<
+ using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = __enable_if_t<
(is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
(!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
- >::type;
+ >;
template <class _UDel>
- using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = typename enable_if<
+ using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t<
is_assignable<_Dp&, _UDel&&>::value
- >::type;
+ >;
public:
template <bool _Dummy = true,
diff --git a/libcxx/include/__type_traits/invoke.h b/libcxx/include/__type_traits/invoke.h
index f3c00e7ede7c37..5368024955799b 100644
--- a/libcxx/include/__type_traits/invoke.h
+++ b/libcxx/include/__type_traits/invoke.h
@@ -240,11 +240,11 @@ template <class _Fp,
class _DecayA0 = __decay_t<_A0>,
class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
using __enable_if_bullet1 =
- typename enable_if<is_member_function_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value >::type;
+ __enable_if_t<is_member_function_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value>;
template <class _Fp, class _A0, class _DecayFp = __decay_t<_Fp>, class _DecayA0 = __decay_t<_A0> >
using __enable_if_bullet2 =
- typename enable_if<is_member_function_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value >::type;
+ __enable_if_t<is_member_function_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value>;
template <class _Fp,
class _A0,
@@ -252,8 +252,8 @@ template <class _Fp,
class _DecayA0 = __decay_t<_A0>,
class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
using __enable_if_bullet3 =
- typename enable_if<is_member_function_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value &&
- !__is_reference_wrapper<_DecayA0>::value >::type;
+ __enable_if_t<is_member_function_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value &&
+ !__is_reference_wrapper<_DecayA0>::value>;
template <class _Fp,
class _A0,
@@ -261,11 +261,11 @@ template <class _Fp,
class _DecayA0 = __decay_t<_A0>,
class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
using __enable_if_bullet4 =
- typename enable_if<is_member_object_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value >::type;
+ __enable_if_t<is_member_object_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value>;
template <class _Fp, class _A0, class _DecayFp = __decay_t<_Fp>, class _DecayA0 = __decay_t<_A0> >
using __enable_if_bullet5 =
- typename enable_if<is_member_object_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value >::type;
+ __enable_if_t<is_member_object_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value>;
template <class _Fp,
class _A0,
@@ -273,8 +273,8 @@ template <class _Fp,
class _DecayA0 = __decay_t<_A0>,
class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
using __enable_if_bullet6 =
- typename enable_if<is_member_object_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value &&
- !__is_reference_wrapper<_DecayA0>::value >::type;
+ __enable_if_t<is_member_object_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value &&
+ !__is_reference_wrapper<_DecayA0>::value>;
// __invoke forward declarations
diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h
index efcc9b004973bf..ea8c03a8aaa0cd 100644
--- a/libcxx/include/__type_traits/is_swappable.h
+++ b/libcxx/include/__type_traits/is_swappable.h
@@ -37,7 +37,7 @@ struct __is_nothrow_swappable;
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type;
+using __swap_result_t = __enable_if_t<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>;
#else
template <class>
using __swap_result_t = void;
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 79b0ca473b43ef..85d2f21af2420f 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -165,34 +165,28 @@ struct _LIBCPP_TEMPLATE_VIS pair
using _CheckArgsDep _LIBCPP_NODEBUG = typename conditional<
_MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
- template<bool _Dummy = true, typename enable_if<
- _CheckArgsDep<_Dummy>::__enable_explicit_default()
- >::type* = nullptr>
+ template<bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_explicit_default(), int> = 0>
explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
is_nothrow_default_constructible<second_type>::value)
: first(), second() {}
- template<bool _Dummy = true, typename enable_if<
- _CheckArgsDep<_Dummy>::__enable_implicit_default()
- >::type* = nullptr>
+ template<bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_implicit_default(), int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
is_nothrow_default_constructible<second_type>::value)
: first(), second() {}
- template <bool _Dummy = true, typename enable_if<
- _CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>()
- >::type* = nullptr>
+ template <bool _Dummy = true,
+ __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>(), int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
explicit pair(_T1 const& __t1, _T2 const& __t2)
_NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
is_nothrow_copy_constructible<second_type>::value)
: first(__t1), second(__t2) {}
- template<bool _Dummy = true, typename enable_if<
- _CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>()
- >::type* = nullptr>
+ template<bool _Dummy = true,
+ __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>(), int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
pair(_T1 const& __t1, _T2 const& __t2)
_NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
@@ -205,7 +199,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
#else
class _U1, class _U2,
#endif
- typename enable_if<_CheckArgs::template __enable_explicit<_U1, _U2>()>::type* = nullptr
+ __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0
>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
explicit pair(_U1&& __u1, _U2&& __u2)
@@ -219,7 +213,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
#else
class _U1, class _U2,
#endif
- typename enable_if<_CheckArgs::template __enable_implicit<_U1, _U2>()>::type* = nullptr
+ __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0
>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
pair(_U1&& __u1, _U2&& __u2)
@@ -238,36 +232,28 @@ struct _LIBCPP_TEMPLATE_VIS pair
: first(__p.first), second(__p.second) {}
#endif
- template<class _U1, class _U2, typename enable_if<
- _CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>()
- >::type* = nullptr>
+ template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>(), int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
explicit pair(pair<_U1, _U2> const& __p)
_NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
is_nothrow_constructible<second_type, _U2 const&>::value))
: first(__p.first), second(__p.second) {}
- template<class _U1, class _U2, typename enable_if<
- _CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>()
- >::type* = nullptr>
+ template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>(), int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
pair(pair<_U1, _U2> const& __p)
_NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
is_nothrow_constructible<second_type, _U2 const&>::value))
: first(__p.first), second(__p.second) {}
- template<class _U1, class _U2, typename enable_if<
- _CheckArgs::template __enable_explicit<_U1, _U2>()
- >::type* = nullptr>
+ template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
explicit pair(pair<_U1, _U2>&&__p)
_NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
is_nothrow_constructible<second_type, _U2&&>::value))
: first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
- template<class _U1, class _U2, typename enable_if<
- _CheckArgs::template __enable_implicit<_U1, _U2>()
- >::type* = nullptr>
+ template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
pair(pair<_U1, _U2>&& __p)
_NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
diff --git a/libcxx/include/__utility/swap.h b/libcxx/include/__utility/swap.h
index a4e1ba08284d21..91c928a9fdf1c5 100644
--- a/libcxx/include/__utility/swap.h
+++ b/libcxx/include/__utility/swap.h
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type;
+using __swap_result_t = __enable_if_t<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>;
#else
template <class>
using __swap_result_t = void;
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 60f7e7c966dea8..89370086106c5e 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -1388,10 +1388,8 @@ struct __is_istreamable<_Stream, _Tp, decltype(
std::declval<_Stream>() >> std::declval<_Tp>(), void()
)> : true_type { };
-template <class _Stream, class _Tp, class = typename enable_if<
- _And<is_base_of<ios_base, _Stream>,
- __is_istreamable<_Stream&, _Tp&&> >::value
->::type>
+template <class _Stream, class _Tp, __enable_if_t<
+ _And<is_base_of<ios_base, _Stream>, __is_istreamable<_Stream&, _Tp&&> >::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
_Stream&& operator>>(_Stream&& __is, _Tp&& __x)
{
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index 4c59b264db741f..f30cfe26e75517 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -1074,10 +1074,9 @@ struct __is_ostreamable<_Stream, _Tp, decltype(
std::declval<_Stream>() << std::declval<_Tp>(), void()
)> : true_type { };
-template <class _Stream, class _Tp, class = typename enable_if<
- _And<is_base_of<ios_base, _Stream>,
- __is_ostreamable<_Stream&, const _Tp&> >::value
->::type>
+template <class _Stream,
+ class _Tp,
+ __enable_if_t<_And<is_base_of<ios_base, _Stream>, __is_ostreamable<_Stream&, const _Tp&> >::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
_Stream&& operator<<(_Stream&& __os, const _Tp& __x)
{
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 8cfe2d9ba3a55f..e8865ac1089d6f 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -3106,8 +3106,7 @@ private:
#if _LIBCPP_STD_VER >= 17
template <class _ForwardIterator,
- class = typename enable_if<__has_forward_iterator_category<_ForwardIterator>::value, nullptr_t>::type
->
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
basic_regex(_ForwardIterator, _ForwardIterator,
regex_constants::syntax_option_type = regex_constants::ECMAScript)
-> basic_regex<typename iterator_traits<_ForwardIterator>::value_type>;
diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator
index 90c6f84b7de76a..55f48bb4d1008c 100644
--- a/libcxx/include/scoped_allocator
+++ b/libcxx/include/scoped_allocator
@@ -229,9 +229,7 @@ protected:
__scoped_allocator_storage() _NOEXCEPT {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, _OuterA2>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outer_alloc,
const _InnerAllocs& ...__inner_allocs) _NOEXCEPT
@@ -239,9 +237,7 @@ protected:
__inner_(__inner_allocs...) {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, const _OuterA2&>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
@@ -249,9 +245,7 @@ protected:
__inner_(__other.inner_allocator()) {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, _OuterA2>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
@@ -259,9 +253,7 @@ protected:
__inner_(_VSTD::move(__other.inner_allocator())) {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, _OuterA2>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i) _NOEXCEPT
@@ -310,26 +302,20 @@ protected:
__scoped_allocator_storage() _NOEXCEPT {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, _OuterA2>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outer_alloc) _NOEXCEPT
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outer_alloc)) {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, const _OuterA2&>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
: outer_allocator_type(__other.outer_allocator()) {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, _OuterA2>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
@@ -454,26 +440,20 @@ public:
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor() _NOEXCEPT {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, _OuterA2>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __outer_alloc,
const _InnerAllocs& ...__inner_allocs) _NOEXCEPT
: base(_VSTD::forward<_OuterA2>(__outer_alloc), __inner_allocs...) {}
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, const _OuterA2&>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
: base(__other) {}
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, _OuterA2>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
@@ -600,9 +580,7 @@ private:
template <class _OuterA2,
- class = typename enable_if<
- is_constructible<outer_allocator_type, _OuterA2>::value
- >::type>
+ __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __o,
const inner_allocator_type& __i) _NOEXCEPT
More information about the libcxx-commits
mailing list