[libcxx-commits] [libcxx] ed2d364 - [libc++][NFC] Prefer type aliases over structs
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Oct 1 13:49:45 PDT 2022
Author: Nikolas Klauser
Date: 2022-10-01T22:49:36+02:00
New Revision: ed2d3644abee9535eb07333beb1562a651001281
URL: https://github.com/llvm/llvm-project/commit/ed2d3644abee9535eb07333beb1562a651001281
DIFF: https://github.com/llvm/llvm-project/commit/ed2d3644abee9535eb07333beb1562a651001281.diff
LOG: [libc++][NFC] Prefer type aliases over structs
Reviewed By: ldionne, #libc
Spies: sstefan1, libcxx-commits, jeroen.dobbelaere
Differential Revision: https://reviews.llvm.org/D134901
Added:
Modified:
libcxx/include/__algorithm/binary_search.h
libcxx/include/__algorithm/comp_ref_type.h
libcxx/include/__algorithm/equal_range.h
libcxx/include/__algorithm/includes.h
libcxx/include/__algorithm/inplace_merge.h
libcxx/include/__algorithm/is_heap.h
libcxx/include/__algorithm/is_heap_until.h
libcxx/include/__algorithm/is_sorted.h
libcxx/include/__algorithm/is_sorted_until.h
libcxx/include/__algorithm/lexicographical_compare.h
libcxx/include/__algorithm/make_heap.h
libcxx/include/__algorithm/max.h
libcxx/include/__algorithm/max_element.h
libcxx/include/__algorithm/merge.h
libcxx/include/__algorithm/min.h
libcxx/include/__algorithm/min_element.h
libcxx/include/__algorithm/next_permutation.h
libcxx/include/__algorithm/nth_element.h
libcxx/include/__algorithm/partial_sort.h
libcxx/include/__algorithm/partial_sort_copy.h
libcxx/include/__algorithm/pop_heap.h
libcxx/include/__algorithm/prev_permutation.h
libcxx/include/__algorithm/push_heap.h
libcxx/include/__algorithm/set_difference.h
libcxx/include/__algorithm/set_intersection.h
libcxx/include/__algorithm/set_symmetric_difference.h
libcxx/include/__algorithm/set_union.h
libcxx/include/__algorithm/sort.h
libcxx/include/__algorithm/sort_heap.h
libcxx/include/__algorithm/stable_sort.h
libcxx/include/__algorithm/unique_copy.h
libcxx/include/__bit_reference
libcxx/include/__coroutine/coroutine_traits.h
libcxx/include/__functional/function.h
libcxx/include/__functional/invoke.h
libcxx/include/__functional/is_transparent.h
libcxx/include/__hash_table
libcxx/include/__iterator/iterator_traits.h
libcxx/include/__memory/allocator_traits.h
libcxx/include/__memory/pointer_traits.h
libcxx/include/__random/independent_bits_engine.h
libcxx/include/__random/log2.h
libcxx/include/__random/uniform_int_distribution.h
libcxx/include/__tree
libcxx/include/__type_traits/aligned_storage.h
libcxx/include/__type_traits/can_extract_key.h
libcxx/include/__type_traits/common_type.h
libcxx/include/__type_traits/is_allocator.h
libcxx/include/__type_traits/is_swappable.h
libcxx/include/__type_traits/maybe_const.h
libcxx/include/__type_traits/void_t.h
libcxx/include/__utility/move.h
libcxx/include/__utility/pair.h
libcxx/include/array
libcxx/include/atomic
libcxx/include/experimental/__memory
libcxx/include/experimental/coroutine
libcxx/include/forward_list
libcxx/include/list
libcxx/include/ostream
Removed:
################################################################################
diff --git a/libcxx/include/__algorithm/binary_search.h b/libcxx/include/__algorithm/binary_search.h
index 863ff1c3af45a..8f958c2c1ad89 100644
--- a/libcxx/include/__algorithm/binary_search.h
+++ b/libcxx/include/__algorithm/binary_search.h
@@ -27,8 +27,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{
- using _Comp_ref = typename __comp_ref_type<_Compare>::type;
- __first = std::lower_bound<_ForwardIterator, _Tp, _Comp_ref>(__first, __last, __value, __comp);
+ __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
return __first != __last && !__comp(__value, *__first);
}
diff --git a/libcxx/include/__algorithm/comp_ref_type.h b/libcxx/include/__algorithm/comp_ref_type.h
index 21a5b90efc9a5..f0a0a31665025 100644
--- a/libcxx/include/__algorithm/comp_ref_type.h
+++ b/libcxx/include/__algorithm/comp_ref_type.h
@@ -64,16 +64,15 @@ struct __debug_less
void __do_compare_assert(long, _LHS &, _RHS &) {}
};
-template <class _Comp>
-struct __comp_ref_type {
- // Pass the comparator by lvalue reference. Or in debug mode, using a
- // debugging wrapper that stores a reference.
+// Pass the comparator by lvalue reference. Or in debug mode, using a
+// debugging wrapper that stores a reference.
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
- typedef __debug_less<_Comp> type;
+template <class _Comp>
+using __comp_ref_type = __debug_less<_Comp>;
#else
- typedef _Comp& type;
+template <class _Comp>
+using __comp_ref_type = _Comp&;
#endif
-};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__algorithm/equal_range.h b/libcxx/include/__algorithm/equal_range.h
index e0a1af591ef72..2075b03412e30 100644
--- a/libcxx/include/__algorithm/equal_range.h
+++ b/libcxx/include/__algorithm/equal_range.h
@@ -64,9 +64,12 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
"The comparator has to be callable");
static_assert(is_copy_constructible<_ForwardIterator>::value,
"Iterator has to be copy constructible");
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
return std::__equal_range<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), __value, static_cast<_Comp_ref>(__comp), std::__identity());
+ std::move(__first),
+ std::move(__last),
+ __value,
+ static_cast<__comp_ref_type<_Compare> >(__comp),
+ std::__identity());
}
template <class _ForwardIterator, class _Tp>
diff --git a/libcxx/include/__algorithm/includes.h b/libcxx/include/__algorithm/includes.h
index ab2c500f8f000..cc39f275bf448 100644
--- a/libcxx/include/__algorithm/includes.h
+++ b/libcxx/include/__algorithm/includes.h
@@ -48,10 +48,14 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
static_assert(__is_callable<_Compare, decltype(*__first1), decltype(*__first2)>::value,
"Comparator has to be callable");
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
return std::__includes(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- static_cast<_Comp_ref>(__comp), __identity(), __identity());
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ static_cast<__comp_ref_type<_Compare> >(__comp),
+ __identity(),
+ __identity());
}
template <class _InputIterator1, class _InputIterator2>
diff --git a/libcxx/include/__algorithm/inplace_merge.h b/libcxx/include/__algorithm/inplace_merge.h
index dc5108aace56f..5bbefc94bdf2d 100644
--- a/libcxx/include/__algorithm/inplace_merge.h
+++ b/libcxx/include/__algorithm/inplace_merge.h
@@ -237,9 +237,8 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
template <class _BidirectionalIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI void inplace_merge(
_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare __comp) {
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
std::__inplace_merge<_ClassicAlgPolicy>(
- std::move(__first), std::move(__middle), std::move(__last), static_cast<_Comp_ref>(__comp));
+ std::move(__first), std::move(__middle), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp));
}
template <class _BidirectionalIterator>
diff --git a/libcxx/include/__algorithm/is_heap.h b/libcxx/include/__algorithm/is_heap.h
index c2661494e745c..2dcb4a28e8d77 100644
--- a/libcxx/include/__algorithm/is_heap.h
+++ b/libcxx/include/__algorithm/is_heap.h
@@ -27,8 +27,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return std::__is_heap_until(__first, __last, static_cast<_Comp_ref>(__comp)) == __last;
+ return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last;
}
template<class _RandomAccessIterator>
diff --git a/libcxx/include/__algorithm/is_heap_until.h b/libcxx/include/__algorithm/is_heap_until.h
index d7cac17dde8e0..6ed4cb29c4234 100644
--- a/libcxx/include/__algorithm/is_heap_until.h
+++ b/libcxx/include/__algorithm/is_heap_until.h
@@ -51,8 +51,7 @@ template <class _RandomAccessIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return std::__is_heap_until(__first, __last, static_cast<_Comp_ref>(__comp));
+ return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
}
template<class _RandomAccessIterator>
diff --git a/libcxx/include/__algorithm/is_sorted.h b/libcxx/include/__algorithm/is_sorted.h
index e12da03f3496b..bf44f45764d56 100644
--- a/libcxx/include/__algorithm/is_sorted.h
+++ b/libcxx/include/__algorithm/is_sorted.h
@@ -27,8 +27,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__is_sorted_until<_Comp_ref>(__first, __last, __comp) == __last;
+ return _VSTD::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp) == __last;
}
template<class _ForwardIterator>
diff --git a/libcxx/include/__algorithm/is_sorted_until.h b/libcxx/include/__algorithm/is_sorted_until.h
index 0368d12f5b6f9..b6683000a0690 100644
--- a/libcxx/include/__algorithm/is_sorted_until.h
+++ b/libcxx/include/__algorithm/is_sorted_until.h
@@ -41,8 +41,7 @@ template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__is_sorted_until<_Comp_ref>(__first, __last, __comp);
+ return _VSTD::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp);
}
template<class _ForwardIterator>
diff --git a/libcxx/include/__algorithm/lexicographical_compare.h b/libcxx/include/__algorithm/lexicographical_compare.h
index 4a3ba6c2419c7..0a13c5dd31c88 100644
--- a/libcxx/include/__algorithm/lexicographical_compare.h
+++ b/libcxx/include/__algorithm/lexicographical_compare.h
@@ -42,8 +42,7 @@ bool
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
+ return _VSTD::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp);
}
template <class _InputIterator1, class _InputIterator2>
diff --git a/libcxx/include/__algorithm/make_heap.h b/libcxx/include/__algorithm/make_heap.h
index b1e21920b3fe8..d66cfe2e5fc98 100644
--- a/libcxx/include/__algorithm/make_heap.h
+++ b/libcxx/include/__algorithm/make_heap.h
@@ -26,8 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
- using _CompRef = typename __comp_ref_type<_Compare>::type;
- _CompRef __comp_ref = __comp;
+ __comp_ref_type<_Compare> __comp_ref = __comp;
using
diff erence_type = typename iterator_traits<_RandomAccessIterator>::
diff erence_type;
diff erence_type __n = __last - __first;
diff --git a/libcxx/include/__algorithm/max.h b/libcxx/include/__algorithm/max.h
index e9579b80ff5d1..a08a3fc59bdad 100644
--- a/libcxx/include/__algorithm/max.h
+++ b/libcxx/include/__algorithm/max.h
@@ -50,8 +50,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
_Tp
max(initializer_list<_Tp> __t, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return *_VSTD::__max_element<_Comp_ref>(__t.begin(), __t.end(), __comp);
+ return *_VSTD::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
}
template<class _Tp>
diff --git a/libcxx/include/__algorithm/max_element.h b/libcxx/include/__algorithm/max_element.h
index fb834ead449fe..6ac310619bf9c 100644
--- a/libcxx/include/__algorithm/max_element.h
+++ b/libcxx/include/__algorithm/max_element.h
@@ -40,8 +40,7 @@ template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__max_element<_Comp_ref>(__first, __last, __comp);
+ return _VSTD::__max_element<__comp_ref_type<_Compare> >(__first, __last, __comp);
}
diff --git a/libcxx/include/__algorithm/merge.h b/libcxx/include/__algorithm/merge.h
index 536a5f80a61f6..e54e430bcb6a7 100644
--- a/libcxx/include/__algorithm/merge.h
+++ b/libcxx/include/__algorithm/merge.h
@@ -51,8 +51,7 @@ _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
+ return _VSTD::__merge<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp);
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
diff --git a/libcxx/include/__algorithm/min.h b/libcxx/include/__algorithm/min.h
index 35b6b66397824..2882485ad76f9 100644
--- a/libcxx/include/__algorithm/min.h
+++ b/libcxx/include/__algorithm/min.h
@@ -50,8 +50,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
_Tp
min(initializer_list<_Tp> __t, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return *_VSTD::__min_element<_Comp_ref>(__t.begin(), __t.end(), __comp);
+ return *_VSTD::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
}
template<class _Tp>
diff --git a/libcxx/include/__algorithm/min_element.h b/libcxx/include/__algorithm/min_element.h
index ef5564316861b..c0706fe9e44dd 100644
--- a/libcxx/include/__algorithm/min_element.h
+++ b/libcxx/include/__algorithm/min_element.h
@@ -54,8 +54,7 @@ min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value,
"The comparator has to be callable");
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return std::__min_element<_Comp_ref>(std::move(__first), std::move(__last), __comp);
+ return std::__min_element<__comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp);
}
template <class _ForwardIterator>
diff --git a/libcxx/include/__algorithm/next_permutation.h b/libcxx/include/__algorithm/next_permutation.h
index ac03c65ce263b..73e8b99ab90b6 100644
--- a/libcxx/include/__algorithm/next_permutation.h
+++ b/libcxx/include/__algorithm/next_permutation.h
@@ -60,9 +60,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
bool
next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
{
- using _Comp_ref = typename __comp_ref_type<_Compare>::type;
return std::__next_permutation<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), static_cast<_Comp_ref>(__comp)).second;
+ std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second;
}
template <class _BidirectionalIterator>
diff --git a/libcxx/include/__algorithm/nth_element.h b/libcxx/include/__algorithm/nth_element.h
index b8aa4bc60612b..9fdfb2cae64ca 100644
--- a/libcxx/include/__algorithm/nth_element.h
+++ b/libcxx/include/__algorithm/nth_element.h
@@ -231,8 +231,7 @@ void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __n
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
- using _Comp_ref = typename __comp_ref_type<_Compare>::type;
- std::__nth_element<_AlgPolicy, _Comp_ref>(__first, __nth, __last, __comp);
+ std::__nth_element<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __nth, __last, __comp);
std::__debug_randomize_range<_AlgPolicy>(__first, __nth);
if (__nth != __last) {
diff --git a/libcxx/include/__algorithm/partial_sort.h b/libcxx/include/__algorithm/partial_sort.h
index bd356c01ae38c..861a5b28dd52f 100644
--- a/libcxx/include/__algorithm/partial_sort.h
+++ b/libcxx/include/__algorithm/partial_sort.h
@@ -63,8 +63,8 @@ _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAcces
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
- using _Comp_ref = typename __comp_ref_type<_Compare>::type;
- auto __last_iter = std::__partial_sort_impl<_AlgPolicy>(__first, __middle, __last, static_cast<_Comp_ref>(__comp));
+ auto __last_iter =
+ std::__partial_sort_impl<_AlgPolicy>(__first, __middle, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
std::__debug_randomize_range<_AlgPolicy>(__middle, __last);
diff --git a/libcxx/include/__algorithm/partial_sort_copy.h b/libcxx/include/__algorithm/partial_sort_copy.h
index deffc42daa12b..1aba07105dc87 100644
--- a/libcxx/include/__algorithm/partial_sort_copy.h
+++ b/libcxx/include/__algorithm/partial_sort_copy.h
@@ -68,9 +68,8 @@ partial_sort_copy(_InputIterator __first, _InputIterator __last,
static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__result_first)>::value,
"Comparator has to be callable");
- using _Comp_ref = typename __comp_ref_type<_Compare>::type;
auto __result = std::__partial_sort_copy<_ClassicAlgPolicy>(__first, __last, __result_first, __result_last,
- static_cast<_Comp_ref>(__comp), __identity(), __identity());
+ static_cast<__comp_ref_type<_Compare> >(__comp), __identity(), __identity());
return __result.second;
}
diff --git a/libcxx/include/__algorithm/pop_heap.h b/libcxx/include/__algorithm/pop_heap.h
index 28501fbe30125..94d32a42391bf 100644
--- a/libcxx/include/__algorithm/pop_heap.h
+++ b/libcxx/include/__algorithm/pop_heap.h
@@ -32,8 +32,7 @@ void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
typename iterator_traits<_RandomAccessIterator>::
diff erence_type __len) {
_LIBCPP_ASSERT(__len > 0, "The heap given to pop_heap must be non-empty");
- using _CompRef = typename __comp_ref_type<_Compare>::type;
- _CompRef __comp_ref = __comp;
+ __comp_ref_type<_Compare> __comp_ref = __comp;
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
if (__len > 1) {
diff --git a/libcxx/include/__algorithm/prev_permutation.h b/libcxx/include/__algorithm/prev_permutation.h
index 0374b497cb1fd..0b86ab74ee011 100644
--- a/libcxx/include/__algorithm/prev_permutation.h
+++ b/libcxx/include/__algorithm/prev_permutation.h
@@ -61,9 +61,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
bool
prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
{
- using _Comp_ref = typename __comp_ref_type<_Compare>::type;
return std::__prev_permutation<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), static_cast<_Comp_ref>(__comp)).second;
+ std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second;
}
template <class _BidirectionalIterator>
diff --git a/libcxx/include/__algorithm/push_heap.h b/libcxx/include/__algorithm/push_heap.h
index 528301f633a5e..90684957744df 100644
--- a/libcxx/include/__algorithm/push_heap.h
+++ b/libcxx/include/__algorithm/push_heap.h
@@ -52,9 +52,8 @@ void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
void __push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
- using _CompRef = typename __comp_ref_type<_Compare>::type;
typename iterator_traits<_RandomAccessIterator>::
diff erence_type __len = __last - __first;
- std::__sift_up<_AlgPolicy, _CompRef>(std::move(__first), std::move(__last), __comp, __len);
+ std::__sift_up<_AlgPolicy, __comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp, __len);
}
template <class _RandomAccessIterator, class _Compare>
diff --git a/libcxx/include/__algorithm/set_
diff erence.h b/libcxx/include/__algorithm/set_
diff erence.h
index 2b219e41cc83b..e0385bf822ff9 100644
--- a/libcxx/include/__algorithm/set_
diff erence.h
+++ b/libcxx/include/__algorithm/set_
diff erence.h
@@ -53,8 +53,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d
_InputIterator2 __last2,
_OutputIterator __result,
_Compare __comp) {
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return std::__set_
diff erence<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp).second;
+ return std::__set_
diff erence<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp)
+ .second;
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
diff --git a/libcxx/include/__algorithm/set_intersection.h b/libcxx/include/__algorithm/set_intersection.h
index 3b0bfbab7f61a..9fa7799aee620 100644
--- a/libcxx/include/__algorithm/set_intersection.h
+++ b/libcxx/include/__algorithm/set_intersection.h
@@ -66,8 +66,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_i
_InputIterator2 __last2,
_OutputIterator __result,
_Compare __comp) {
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return std::__set_intersection<_ClassicAlgPolicy, _Comp_ref>(
+ return std::__set_intersection<_ClassicAlgPolicy, __comp_ref_type<_Compare> >(
std::move(__first1),
std::move(__last1),
std::move(__first2),
diff --git a/libcxx/include/__algorithm/set_symmetric_
diff erence.h b/libcxx/include/__algorithm/set_symmetric_
diff erence.h
index 3dd093c9e1489..97d3f1da7c249 100644
--- a/libcxx/include/__algorithm/set_symmetric_
diff erence.h
+++ b/libcxx/include/__algorithm/set_symmetric_
diff erence.h
@@ -72,8 +72,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_symmetri
_InputIterator2 __last2,
_OutputIterator __result,
_Compare __comp) {
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return std::__set_symmetric_
diff erence<_Comp_ref>(
+ return std::__set_symmetric_
diff erence<__comp_ref_type<_Compare> >(
std::move(__first1),
std::move(__last1),
std::move(__first2),
diff --git a/libcxx/include/__algorithm/set_union.h b/libcxx/include/__algorithm/set_union.h
index ce15623942b8e..addc77b7d8053 100644
--- a/libcxx/include/__algorithm/set_union.h
+++ b/libcxx/include/__algorithm/set_union.h
@@ -68,8 +68,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_union(
_InputIterator2 __last2,
_OutputIterator __result,
_Compare __comp) {
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return std::__set_union<_Comp_ref>(
+ return std::__set_union<__comp_ref_type<_Compare> >(
std::move(__first1),
std::move(__last1),
std::move(__first2),
diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index 4ff3379e7a0b1..ac9c138c339d4 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -683,7 +683,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
- using _Comp_ref = typename __comp_ref_type<_Comp>::type;
+ using _Comp_ref = __comp_ref_type<_Comp>;
if (__libcpp_is_constant_evaluated()) {
std::__partial_sort<_AlgPolicy>(__first, __last, __last, __comp);
diff --git a/libcxx/include/__algorithm/sort_heap.h b/libcxx/include/__algorithm/sort_heap.h
index b4144e9928138..8249407b55099 100644
--- a/libcxx/include/__algorithm/sort_heap.h
+++ b/libcxx/include/__algorithm/sort_heap.h
@@ -27,8 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
- using _CompRef = typename __comp_ref_type<_Compare>::type;
- _CompRef __comp_ref = __comp;
+ __comp_ref_type<_Compare> __comp_ref = __comp;
using
diff erence_type = typename iterator_traits<_RandomAccessIterator>::
diff erence_type;
for (
diff erence_type __n = __last - __first; __n > 1; --__last, (void) --__n)
diff --git a/libcxx/include/__algorithm/stable_sort.h b/libcxx/include/__algorithm/stable_sort.h
index 1b8aafbb19135..8e70978ab61cf 100644
--- a/libcxx/include/__algorithm/stable_sort.h
+++ b/libcxx/include/__algorithm/stable_sort.h
@@ -227,8 +227,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
__h.reset(__buf.first);
}
- using _Comp_ref = typename __comp_ref_type<_Compare>::type;
- std::__stable_sort<_AlgPolicy, _Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
+ std::__stable_sort<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __last, __comp, __len, __buf.first, __buf.second);
}
template <class _RandomAccessIterator, class _Compare>
diff --git a/libcxx/include/__algorithm/unique_copy.h b/libcxx/include/__algorithm/unique_copy.h
index 62f421fb15b5b..e33d795ecfdc8 100644
--- a/libcxx/include/__algorithm/unique_copy.h
+++ b/libcxx/include/__algorithm/unique_copy.h
@@ -97,15 +97,15 @@ __unique_copy(_InputIterator __first,
template <class _InputIterator, class _OutputIterator, class _BinaryPredicate>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __pred) {
- using __algo_tag = typename conditional<
+ using __algo_tag = __conditional_t<
is_base_of<forward_iterator_tag, typename iterator_traits<_InputIterator>::iterator_category>::value,
__unique_copy_tags::__reread_from_input_tag,
- typename conditional<
+ __conditional_t<
is_base_of<forward_iterator_tag, typename iterator_traits<_OutputIterator>::iterator_category>::value &&
is_same< typename iterator_traits<_InputIterator>::value_type,
typename iterator_traits<_OutputIterator>::value_type>::value,
__unique_copy_tags::__reread_from_output_tag,
- __unique_copy_tags::__read_from_tmp_value_tag>::type >::type;
+ __unique_copy_tags::__read_from_tmp_value_tag> >;
return std::__unique_copy<_ClassicAlgPolicy>(
std::move(__first), std::move(__last), std::move(__result), __pred, __algo_tag())
.second;
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 269446a28dab1..9ddd4f3bb8180 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -1115,16 +1115,16 @@ public:
typedef bool value_type;
typedef __bit_iterator pointer;
#ifndef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
- typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
+ typedef __conditional_t<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> > reference;
#else
- using reference = typename conditional<_IsConst, bool, __bit_reference<_Cp> >::type;
+ using reference = __conditional_t<_IsConst, bool, __bit_reference<_Cp> >;
#endif
typedef random_access_iterator_tag iterator_category;
private:
typedef typename _Cp::__storage_type __storage_type;
- typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
- typename _Cp::__storage_pointer>::type __storage_pointer;
+ typedef __conditional_t<_IsConst, typename _Cp::__const_storage_pointer, typename _Cp::__storage_pointer>
+ __storage_pointer;
static const unsigned __bits_per_word = _Cp::__bits_per_word;
__storage_pointer __seg_;
@@ -1159,8 +1159,8 @@ public:
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator*() const _NOEXCEPT {
- return typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >
- ::type(__seg_, __storage_type(1) << __ctz_);
+ return __conditional_t<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >(
+ __seg_, __storage_type(1) << __ctz_);
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator& operator++()
diff --git a/libcxx/include/__coroutine/coroutine_traits.h b/libcxx/include/__coroutine/coroutine_traits.h
index 0a5229b459454..64cb275ec368b 100644
--- a/libcxx/include/__coroutine/coroutine_traits.h
+++ b/libcxx/include/__coroutine/coroutine_traits.h
@@ -35,7 +35,7 @@ struct __coroutine_traits_sfinae {};
template <class _Tp>
struct __coroutine_traits_sfinae<
- _Tp, typename __void_t<typename _Tp::promise_type>::type>
+ _Tp, __void_t<typename _Tp::promise_type> >
{
using promise_type = typename _Tp::promise_type;
};
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index e8bcb6b737895..eb38ae8e5aa50 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -676,8 +676,7 @@ struct __policy
// Used to choose between perfect forwarding or pass-by-value. Pass-by-value is
// faster for types that can be passed in registers.
template <typename _Tp>
-using __fast_forward =
- typename conditional<is_scalar<_Tp>::value, _Tp, _Tp&&>::type;
+using __fast_forward = __conditional_t<is_scalar<_Tp>::value, _Tp, _Tp&&>;
// __policy_invoker calls an instance of __alloc_func held in __policy_storage.
diff --git a/libcxx/include/__functional/invoke.h b/libcxx/include/__functional/invoke.h
index 39641505a5073..fdbbce029e88c 100644
--- a/libcxx/include/__functional/invoke.h
+++ b/libcxx/include/__functional/invoke.h
@@ -406,10 +406,10 @@ struct __invokable_r
// or incomplete array types as required by the standard.
using _Result = decltype(__try_call<_Fp, _Args...>(0));
- using type = typename conditional<
+ using type = __conditional_t<
_IsNotSame<_Result, __nat>::value,
- typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type,
- false_type >::type;
+ __conditional_t<is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >,
+ false_type>;
static const bool value = type::value;
};
template <class _Fp, class ..._Args>
diff --git a/libcxx/include/__functional/is_transparent.h b/libcxx/include/__functional/is_transparent.h
index 74326c76c12f8..c7a0ee9ee7b88 100644
--- a/libcxx/include/__functional/is_transparent.h
+++ b/libcxx/include/__functional/is_transparent.h
@@ -25,8 +25,7 @@ template <class _Tp, class, class = void>
struct __is_transparent : false_type {};
template <class _Tp, class _Up>
-struct __is_transparent<_Tp, _Up,
- typename __void_t<typename _Tp::is_transparent>::type>
+struct __is_transparent<_Tp, _Up, __void_t<typename _Tp::is_transparent> >
: true_type {};
#endif
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index bd456898ad59c..50439926dc531 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -73,10 +73,7 @@ struct __hash_node_base
#if defined(_LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB)
typedef __node_base_pointer __next_pointer;
#else
- typedef typename conditional<
- is_pointer<__node_pointer>::value,
- __node_base_pointer,
- __node_pointer>::type __next_pointer;
+ typedef __conditional_t<is_pointer<__node_pointer>::value, __node_base_pointer, __node_pointer> __next_pointer;
#endif
__next_pointer __next_;
diff --git a/libcxx/include/__iterator/iterator_traits.h b/libcxx/include/__iterator/iterator_traits.h
index e8c853767a7be..918c7138ec187 100644
--- a/libcxx/include/__iterator/iterator_traits.h
+++ b/libcxx/include/__iterator/iterator_traits.h
@@ -108,11 +108,11 @@ struct __has_iterator_typedefs
{
private:
template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename __void_t<typename _Up::iterator_category>::type* = 0,
- typename __void_t<typename _Up::
diff erence_type>::type* = 0,
- typename __void_t<typename _Up::value_type>::type* = 0,
- typename __void_t<typename _Up::reference>::type* = 0,
- typename __void_t<typename _Up::pointer>::type* = 0);
+ template <class _Up> static true_type __test(__void_t<typename _Up::iterator_category>* = nullptr,
+ __void_t<typename _Up::
diff erence_type>* = nullptr,
+ __void_t<typename _Up::value_type>* = nullptr,
+ __void_t<typename _Up::reference>* = nullptr,
+ __void_t<typename _Up::pointer>* = nullptr);
public:
static const bool value = decltype(__test<_Tp>(0,0,0,0,0))::value;
};
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
index d184be24c2103..cfc636dd8cb2c 100644
--- a/libcxx/include/__memory/allocator_traits.h
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -28,7 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#define _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
template <class _Tp, class = void> struct NAME : false_type { }; \
- template <class _Tp> struct NAME<_Tp, typename __void_t<typename _Tp:: PROPERTY >::type> : true_type { }
+ template <class _Tp> struct NAME<_Tp, __void_t<typename _Tp:: PROPERTY > > : true_type { }
// __pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer);
@@ -152,9 +152,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp, class _Up, class = void>
struct __has_rebind_other : false_type { };
template <class _Tp, class _Up>
-struct __has_rebind_other<_Tp, _Up, typename __void_t<
- typename _Tp::template rebind<_Up>::other
->::type> : true_type { };
+struct __has_rebind_other<_Tp, _Up, __void_t<typename _Tp::template rebind<_Up>::other> > : true_type { };
template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
struct __allocator_traits_rebind {
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index f4f571c64be91..fd526471781b3 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -25,8 +25,7 @@ template <class _Tp, class = void>
struct __has_element_type : false_type {};
template <class _Tp>
-struct __has_element_type<_Tp,
- typename __void_t<typename _Tp::element_type>::type> : true_type {};
+struct __has_element_type<_Tp, __void_t<typename _Tp::element_type> > : true_type {};
template <class _Ptr, bool = __has_element_type<_Ptr>::value>
struct __pointer_traits_element_type;
@@ -53,8 +52,7 @@ template <class _Tp, class = void>
struct __has_
diff erence_type : false_type {};
template <class _Tp>
-struct __has_
diff erence_type<_Tp,
- typename __void_t<typename _Tp::
diff erence_type>::type> : true_type {};
+struct __has_
diff erence_type<_Tp, __void_t<typename _Tp::
diff erence_type> > : true_type {};
template <class _Ptr, bool = __has_
diff erence_type<_Ptr>::value>
struct __pointer_traits_
diff erence_type
@@ -124,8 +122,7 @@ struct _LIBCPP_TEMPLATE_VIS pointer_traits
struct __nat {};
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer pointer_to(typename conditional<is_void<element_type>::value,
- __nat, element_type>::type& __r)
+ static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r)
{return pointer::pointer_to(__r);}
};
@@ -146,8 +143,7 @@ struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*>
struct __nat {};
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer pointer_to(typename conditional<is_void<element_type>::value,
- __nat, element_type>::type& __r) _NOEXCEPT
+ static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT
{return _VSTD::addressof(__r);}
};
diff --git a/libcxx/include/__random/independent_bits_engine.h b/libcxx/include/__random/independent_bits_engine.h
index 983918a3c2873..151492a81bd0b 100644
--- a/libcxx/include/__random/independent_bits_engine.h
+++ b/libcxx/include/__random/independent_bits_engine.h
@@ -51,12 +51,8 @@ class _LIBCPP_TEMPLATE_VIS independent_bits_engine
static_assert(__w <= _Dt, "independent_bits_engine invalid parameters");
typedef typename _Engine::result_type _Engine_result_type;
- typedef typename conditional
- <
- sizeof(_Engine_result_type) <= sizeof(result_type),
- result_type,
- _Engine_result_type
- >::type _Working_result_type;
+ typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
+ _Working_result_type;
#ifdef _LIBCPP_CXX03_LANG
static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+ _Working_result_type(1);
diff --git a/libcxx/include/__random/log2.h b/libcxx/include/__random/log2.h
index b077d211cefae..72bf0759eeac4 100644
--- a/libcxx/include/__random/log2.h
+++ b/libcxx/include/__random/log2.h
@@ -58,15 +58,12 @@ struct __log2
{
static const size_t value = __log2_imp<
#ifndef _LIBCPP_HAS_NO_INT128
- typename conditional<
- sizeof(_UIntType) <= sizeof(unsigned long long),
- unsigned long long,
- __uint128_t
- >::type,
+ __conditional_t<sizeof(_UIntType) <= sizeof(unsigned long long), unsigned long long, __uint128_t>,
#else
unsigned long long,
#endif // _LIBCPP_HAS_NO_INT128
- _Xp, sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
+ _Xp,
+ sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__random/uniform_int_distribution.h b/libcxx/include/__random/uniform_int_distribution.h
index dcc21925e0374..e9930e857522a 100644
--- a/libcxx/include/__random/uniform_int_distribution.h
+++ b/libcxx/include/__random/uniform_int_distribution.h
@@ -38,12 +38,8 @@ class __independent_bits_engine
private:
typedef typename _Engine::result_type _Engine_result_type;
- typedef typename conditional
- <
- sizeof(_Engine_result_type) <= sizeof(result_type),
- result_type,
- _Engine_result_type
- >::type _Working_result_type;
+ typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
+ _Working_result_type;
_Engine& __e_;
size_t __w_;
@@ -237,8 +233,8 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t), uint32_t,
- __make_unsigned_t<result_type> >::type _UIntType;
+ typedef __conditional_t<sizeof(result_type) <= sizeof(uint32_t), uint32_t, __make_unsigned_t<result_type> >
+ _UIntType;
const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1);
if (_Rp == 1)
return __p.a();
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 4dd48967ddf99..cbdff3c1ea54a 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -647,10 +647,8 @@ struct __tree_node_base_types {
#if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB)
typedef __end_node_pointer __parent_pointer;
#else
- typedef typename conditional<
- is_pointer<__end_node_pointer>::value,
- __end_node_pointer,
- __node_base_pointer>::type __parent_pointer;
+ typedef __conditional_t< is_pointer<__end_node_pointer>::value, __end_node_pointer, __node_base_pointer>
+ __parent_pointer;
#endif
private:
@@ -696,10 +694,8 @@ public:
#if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB)
typedef typename __base::__end_node_pointer __iter_pointer;
#else
- typedef typename conditional<
- is_pointer<__node_pointer>::value,
- typename __base::__end_node_pointer,
- __node_pointer>::type __iter_pointer;
+ typedef __conditional_t< is_pointer<__node_pointer>::value, typename __base::__end_node_pointer, __node_pointer>
+ __iter_pointer;
#endif
private:
static_assert(!is_const<__node_type>::value,
diff --git a/libcxx/include/__type_traits/aligned_storage.h b/libcxx/include/__type_traits/aligned_storage.h
index 9659a90ae50c1..a9f1244ed3cca 100644
--- a/libcxx/include/__type_traits/aligned_storage.h
+++ b/libcxx/include/__type_traits/aligned_storage.h
@@ -54,21 +54,13 @@ template <class _TL, size_t _Align> struct __find_pod;
template <class _Hp, size_t _Align>
struct __find_pod<__type_list<_Hp, __nat>, _Align>
{
- typedef typename conditional<
- _Align == _Hp::value,
- typename _Hp::type,
- __fallback_overaligned<_Align>
- >::type type;
+ typedef __conditional_t<_Align == _Hp::value, typename _Hp::type, __fallback_overaligned<_Align> > type;
};
template <class _Hp, class _Tp, size_t _Align>
struct __find_pod<__type_list<_Hp, _Tp>, _Align>
{
- typedef typename conditional<
- _Align == _Hp::value,
- typename _Hp::type,
- typename __find_pod<_Tp, _Align>::type
- >::type type;
+ typedef __conditional_t<_Align == _Hp::value, typename _Hp::type, typename __find_pod<_Tp, _Align>::type> type;
};
template <class _TL, size_t _Len> struct __find_max_align;
diff --git a/libcxx/include/__type_traits/can_extract_key.h b/libcxx/include/__type_traits/can_extract_key.h
index 72ac1ea15233c..454c56bfae9da 100644
--- a/libcxx/include/__type_traits/can_extract_key.h
+++ b/libcxx/include/__type_traits/can_extract_key.h
@@ -28,16 +28,14 @@ struct __extract_key_fail_tag {};
struct __extract_key_self_tag {};
struct __extract_key_first_tag {};
-template <class _ValTy, class _Key,
- class _RawValTy = __remove_const_ref_t<_ValTy> >
+template <class _ValTy, class _Key, class _RawValTy = __remove_const_ref_t<_ValTy> >
struct __can_extract_key
- : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag,
- __extract_key_fail_tag>::type {};
+ : __conditional_t<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, __extract_key_fail_tag> {};
template <class _Pair, class _Key, class _First, class _Second>
struct __can_extract_key<_Pair, _Key, pair<_First, _Second> >
- : conditional<_IsSame<__remove_const_t<_First>, _Key>::value,
- __extract_key_first_tag, __extract_key_fail_tag>::type {};
+ : __conditional_t<_IsSame<__remove_const_t<_First>, _Key>::value, __extract_key_first_tag, __extract_key_fail_tag> {
+};
// __can_extract_map_key uses true_type/false_type instead of the tags.
// It returns true if _Key != _ContainerValueTy (the container is a map not a set)
diff --git a/libcxx/include/__type_traits/common_type.h b/libcxx/include/__type_traits/common_type.h
index 55321e9936dd4..8009142dfea4f 100644
--- a/libcxx/include/__type_traits/common_type.h
+++ b/libcxx/include/__type_traits/common_type.h
@@ -47,10 +47,7 @@ struct __common_type2_imp {};
// sub-bullet 3 - "if decay_t<decltype(false ? declval<D1>() : declval<D2>())> ..."
template <class _Tp, class _Up>
-struct __common_type2_imp<_Tp, _Up,
- typename __void_t<decltype(
- true ? declval<_Tp>() : declval<_Up>()
- )>::type>
+struct __common_type2_imp<_Tp, _Up, __void_t<decltype(true ? declval<_Tp>() : declval<_Up>())> >
{
typedef _LIBCPP_NODEBUG typename decay<decltype(
true ? declval<_Tp>() : declval<_Up>()
@@ -82,8 +79,7 @@ struct common_type {
template <class _Tp, class _Up>
struct __common_type_impl<
- __common_types<_Tp, _Up>,
- typename __void_t<typename common_type<_Tp, _Up>::type>::type>
+ __common_types<_Tp, _Up>, __void_t<typename common_type<_Tp, _Up>::type> >
{
typedef typename common_type<_Tp, _Up>::type type;
};
@@ -91,7 +87,7 @@ struct __common_type_impl<
template <class _Tp, class _Up, class _Vp _LIBCPP_OPTIONAL_PACK(class... _Rest)>
struct __common_type_impl<
__common_types<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)>,
- typename __void_t<typename common_type<_Tp, _Up>::type>::type>
+ __void_t<typename common_type<_Tp, _Up>::type> >
: __common_type_impl<__common_types<typename common_type<_Tp, _Up>::type,
_Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> > {
};
diff --git a/libcxx/include/__type_traits/is_allocator.h b/libcxx/include/__type_traits/is_allocator.h
index f4d70e9dd71e1..53401e9f4f5cd 100644
--- a/libcxx/include/__type_traits/is_allocator.h
+++ b/libcxx/include/__type_traits/is_allocator.h
@@ -26,8 +26,8 @@ struct __is_allocator : false_type {};
template<typename _Alloc>
struct __is_allocator<_Alloc,
- typename __void_t<typename _Alloc::value_type>::type,
- typename __void_t<decltype(declval<_Alloc&>().allocate(size_t(0)))>::type
+ __void_t<typename _Alloc::value_type>,
+ __void_t<decltype(declval<_Alloc&>().allocate(size_t(0)))>
>
: true_type {};
diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h
index 8db7daa970155..a13118228272a 100644
--- a/libcxx/include/__type_traits/is_swappable.h
+++ b/libcxx/include/__type_traits/is_swappable.h
@@ -118,13 +118,13 @@ struct _LIBCPP_TEMPLATE_VIS is_swappable_with
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_swappable
- : public conditional<
+ : public __conditional_t<
__libcpp_is_referenceable<_Tp>::value,
is_swappable_with<
__add_lvalue_reference_t<_Tp>,
__add_lvalue_reference_t<_Tp> >,
false_type
- >::type
+ >
{
};
@@ -136,13 +136,13 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable
- : public conditional<
+ : public __conditional_t<
__libcpp_is_referenceable<_Tp>::value,
is_nothrow_swappable_with<
__add_lvalue_reference_t<_Tp>,
__add_lvalue_reference_t<_Tp> >,
false_type
- >::type
+ >
{
};
diff --git a/libcxx/include/__type_traits/maybe_const.h b/libcxx/include/__type_traits/maybe_const.h
index 4f1908ae5dd81..8403f6aba7468 100644
--- a/libcxx/include/__type_traits/maybe_const.h
+++ b/libcxx/include/__type_traits/maybe_const.h
@@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template<bool _Const, class _Tp>
-using __maybe_const = typename conditional<_Const, const _Tp, _Tp>::type;
+using __maybe_const = __conditional_t<_Const, const _Tp, _Tp>;
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/void_t.h b/libcxx/include/__type_traits/void_t.h
index a71ab5e4b07f6..1ed4e43548788 100644
--- a/libcxx/include/__type_traits/void_t.h
+++ b/libcxx/include/__type_traits/void_t.h
@@ -21,8 +21,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class...> using void_t = void;
#endif
-template <class>
-struct __void_t { typedef void type; };
+template <class...>
+using __void_t = void;
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__utility/move.h b/libcxx/include/__utility/move.h
index 8fe6af2ef358f..522673005b5fb 100644
--- a/libcxx/include/__utility/move.h
+++ b/libcxx/include/__utility/move.h
@@ -28,8 +28,7 @@ move(_Tp&& __t) _NOEXCEPT {
template <class _Tp>
using __move_if_noexcept_result_t =
- typename conditional<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&,
- _Tp&&>::type;
+ __conditional_t<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>;
template <class _Tp>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp>
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index b6ecb9b5761a9..d9286891189e6 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -135,12 +135,12 @@ struct _LIBCPP_TEMPLATE_VIS pair
};
template <class _Tuple>
- using _CheckTLC _LIBCPP_NODEBUG = typename conditional<
+ using _CheckTLC _LIBCPP_NODEBUG = __conditional_t<
__tuple_like_with_size<_Tuple, 2>::value
&& !is_same<typename decay<_Tuple>::type, pair>::value,
_CheckTupleLikeConstructor,
__check_tuple_constructor_fail
- >::type;
+ >;
template<bool _Dummy = true, typename enable_if<
_CheckArgsDep<_Dummy>::__enable_explicit_default()
@@ -290,10 +290,10 @@ struct _LIBCPP_TEMPLATE_VIS pair
typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(typename conditional<
+ pair& operator=(__conditional_t<
is_copy_assignable<first_type>::value &&
is_copy_assignable<second_type>::value,
- pair, __nat>::type const& __p)
+ pair, __nat> const& __p)
_NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value &&
is_nothrow_copy_assignable<second_type>::value)
{
@@ -303,10 +303,10 @@ struct _LIBCPP_TEMPLATE_VIS pair
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(typename conditional<
+ pair& operator=(__conditional_t<
is_move_assignable<first_type>::value &&
is_move_assignable<second_type>::value,
- pair, __nat>::type&& __p)
+ pair, __nat>&& __p)
_NOEXCEPT_(is_nothrow_move_assignable<first_type>::value &&
is_nothrow_move_assignable<second_type>::value)
{
diff --git a/libcxx/include/array b/libcxx/include/array
index a145b487476f9..af199ca2e7199 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -266,8 +266,7 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef typename conditional<is_const<_Tp>::value, const char,
- char>::type _CharType;
+ typedef __conditional_t<is_const<_Tp>::value, const char, char> _CharType;
struct _ArrayInStructT { _Tp __data_[1]; };
_ALIGNAS_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)];
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index bd44dfee9c020..fac146537d9a2 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -2623,17 +2623,17 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
#endif
#if ATOMIC_LLONG_LOCK_FREE == 2
-typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long>::type __libcpp_signed_lock_free;
-typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long>::type __libcpp_unsigned_lock_free;
+typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long> __libcpp_signed_lock_free;
+typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long> __libcpp_unsigned_lock_free;
#elif ATOMIC_INT_LOCK_FREE == 2
-typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, int>::type __libcpp_signed_lock_free;
-typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned int>::type __libcpp_unsigned_lock_free;
+typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, int> __libcpp_signed_lock_free;
+typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned int> __libcpp_unsigned_lock_free;
#elif ATOMIC_SHORT_LOCK_FREE == 2
-typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, short>::type __libcpp_signed_lock_free;
-typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned short>::type __libcpp_unsigned_lock_free;
+typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, short> __libcpp_signed_lock_free;
+typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned short> __libcpp_unsigned_lock_free;
#elif ATOMIC_CHAR_LOCK_FREE == 2
-typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::type __libcpp_signed_lock_free;
-typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free;
+typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char> __libcpp_signed_lock_free;
+typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char> __libcpp_unsigned_lock_free;
#else
// No signed/unsigned lock-free types
#define _LIBCPP_NO_LOCK_FREE_TYPES
diff --git a/libcxx/include/experimental/__memory b/libcxx/include/experimental/__memory
index 749cf4c0c657f..b36f31eebb7c6 100644
--- a/libcxx/include/experimental/__memory
+++ b/libcxx/include/experimental/__memory
@@ -56,11 +56,11 @@ struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...>
= is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
static const bool __ic_second =
- conditional<
+ __conditional_t<
__ic_first,
false_type,
is_constructible<_Tp, _Args..., _Alloc>
- >::type::value;
+ >::value;
static_assert(__ic_first || __ic_second,
"Request for uses allocator construction is ill-formed");
diff --git a/libcxx/include/experimental/coroutine b/libcxx/include/experimental/coroutine
index ae4fbd9c99f6e..d9f3685350247 100644
--- a/libcxx/include/experimental/coroutine
+++ b/libcxx/include/experimental/coroutine
@@ -84,8 +84,7 @@ template <class _Tp, class = void>
struct __coroutine_traits_sfinae {};
template <class _Tp>
-struct __coroutine_traits_sfinae<
- _Tp, typename __void_t<typename _Tp::promise_type>::type>
+struct __coroutine_traits_sfinae<_Tp, __void_t<typename _Tp::promise_type> >
{
using promise_type = typename _Tp::promise_type;
};
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 4ef2fa0571291..471b78facb168 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -252,18 +252,12 @@ struct __forward_node_traits {
#if defined(_LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB)
typedef __begin_node_pointer __iter_node_pointer;
#else
- typedef typename conditional<
- is_pointer<__void_pointer>::value,
- __begin_node_pointer,
- __node_pointer
- >::type __iter_node_pointer;
+ typedef __conditional_t<is_pointer<__void_pointer>::value, __begin_node_pointer, __node_pointer>
+ __iter_node_pointer;
#endif
- typedef typename conditional<
- is_same<__iter_node_pointer, __node_pointer>::value,
- __begin_node_pointer,
- __node_pointer
- >::type __non_iter_node_pointer;
+ typedef __conditional_t<is_same<__iter_node_pointer, __node_pointer>::value, __begin_node_pointer, __node_pointer>
+ __non_iter_node_pointer;
_LIBCPP_INLINE_VISIBILITY
static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) {
@@ -292,16 +286,11 @@ struct __forward_begin_node
};
template <class _Tp, class _VoidPtr>
-struct _LIBCPP_HIDDEN __begin_node_of
-{
- typedef __forward_begin_node<
- __rebind_pointer_t<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >
- > type;
-};
+using __begin_node_of = __forward_begin_node<__rebind_pointer_t<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> > >;
template <class _Tp, class _VoidPtr>
struct _LIBCPP_STANDALONE_DEBUG __forward_list_node
- : public __begin_node_of<_Tp, _VoidPtr>::type
+ : public __begin_node_of<_Tp, _VoidPtr>
{
typedef _Tp value_type;
@@ -483,7 +472,7 @@ protected:
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
typedef __forward_list_node<value_type, void_pointer> __node;
- typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node;
+ typedef __begin_node_of<value_type, void_pointer> __begin_node;
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator;
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
diff --git a/libcxx/include/list b/libcxx/include/list
index 478fe505cc7b1..b7c4236705287 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -247,18 +247,11 @@ struct __list_node_pointer_traits {
#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB)
typedef __base_pointer __link_pointer;
#else
- typedef typename conditional<
- is_pointer<_VoidPtr>::value,
- __base_pointer,
- __node_pointer
- >::type __link_pointer;
+ typedef __conditional_t<is_pointer<_VoidPtr>::value, __base_pointer, __node_pointer> __link_pointer;
#endif
- typedef typename conditional<
- is_same<__link_pointer, __node_pointer>::value,
- __base_pointer,
- __node_pointer
- >::type __non_link_pointer;
+ typedef __conditional_t<is_same<__link_pointer, __node_pointer>::value, __base_pointer, __node_pointer>
+ __non_link_pointer;
static _LIBCPP_INLINE_VISIBILITY
__link_pointer __unsafe_link_pointer_cast(__link_pointer __p) {
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index c15b058b2c55f..77ec87b35e4fe 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -1112,7 +1112,7 @@ template<class _CharT, class _Traits, class _Yp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_same<void, typename __void_t<decltype((declval<basic_ostream<_CharT, _Traits>&>() << declval<typename unique_ptr<_Yp, _Dp>::pointer>()))>::type>::value,
+ is_same<void, __void_t<decltype((declval<basic_ostream<_CharT, _Traits>&>() << declval<typename unique_ptr<_Yp, _Dp>::pointer>()))> >::value,
basic_ostream<_CharT, _Traits>&
>::type
operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p)
More information about the libcxx-commits
mailing list