aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__algorithm
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/__algorithm')
-rw-r--r--libcxx/include/__algorithm/copy.h3
-rw-r--r--libcxx/include/__algorithm/copy_backward.h3
-rw-r--r--libcxx/include/__algorithm/count.h4
-rw-r--r--libcxx/include/__algorithm/is_permutation.h8
-rw-r--r--libcxx/include/__algorithm/lexicographical_compare_three_way.h12
-rw-r--r--libcxx/include/__algorithm/make_heap.h4
-rw-r--r--libcxx/include/__algorithm/mismatch.h2
-rw-r--r--libcxx/include/__algorithm/move.h3
-rw-r--r--libcxx/include/__algorithm/move_backward.h3
-rw-r--r--libcxx/include/__algorithm/pstl.h4
-rw-r--r--libcxx/include/__algorithm/radix_sort.h52
-rw-r--r--libcxx/include/__algorithm/sift_down.h4
-rw-r--r--libcxx/include/__algorithm/stable_sort.h2
13 files changed, 55 insertions, 49 deletions
diff --git a/libcxx/include/__algorithm/copy.h b/libcxx/include/__algorithm/copy.h
index 6387728..21fd25c 100644
--- a/libcxx/include/__algorithm/copy.h
+++ b/libcxx/include/__algorithm/copy.h
@@ -197,7 +197,8 @@ struct __copy_impl {
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
using _Traits = __segmented_iterator_traits<_OutIter>;
- using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
+ using _DiffT =
+ typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
if (__first == __last)
return std::make_pair(std::move(__first), std::move(__result));
diff --git a/libcxx/include/__algorithm/copy_backward.h b/libcxx/include/__algorithm/copy_backward.h
index 807c64b..6c9eba6 100644
--- a/libcxx/include/__algorithm/copy_backward.h
+++ b/libcxx/include/__algorithm/copy_backward.h
@@ -214,7 +214,8 @@ struct __copy_backward_impl {
auto __local_last = _Traits::__local(__result);
while (true) {
- using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
+ using _DiffT =
+ typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
auto __local_first = _Traits::__begin(__segment_iterator);
auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
diff --git a/libcxx/include/__algorithm/count.h b/libcxx/include/__algorithm/count.h
index 0cbe9b6..8529d11 100644
--- a/libcxx/include/__algorithm/count.h
+++ b/libcxx/include/__algorithm/count.h
@@ -72,7 +72,7 @@ __count_bool(__bit_iterator<_Cp, _IsConst> __first, typename __size_difference_t
}
template <class, class _Cp, bool _IsConst, class _Tp, class _Proj, __enable_if_t<__is_identity<_Proj>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<__bit_iterator<_Cp, _IsConst> >
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iterator_difference_type<__bit_iterator<_Cp, _IsConst> >
__count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value, _Proj&) {
if (__value)
return std::__count_bool<true>(
@@ -82,7 +82,7 @@ __count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __l
}
template <class _InputIterator, class _Tp>
-[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<_InputIterator>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iterator_difference_type<_InputIterator>
count(_InputIterator __first, _InputIterator __last, const _Tp& __value) {
__identity __proj;
return std::__count<_ClassicAlgPolicy>(__first, __last, __value, __proj);
diff --git a/libcxx/include/__algorithm/is_permutation.h b/libcxx/include/__algorithm/is_permutation.h
index 1afb115..86f469c 100644
--- a/libcxx/include/__algorithm/is_permutation.h
+++ b/libcxx/include/__algorithm/is_permutation.h
@@ -78,7 +78,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation_impl(
_Pred&& __pred,
_Proj1&& __proj1,
_Proj2&& __proj2) {
- using _D1 = __iter_diff_t<_Iter1>;
+ using _D1 = __iterator_difference_type<_Iter1>;
for (auto __i = __first1; __i != __last1; ++__i) {
// Have we already counted the number of *__i in [f1, l1)?
@@ -126,7 +126,7 @@ template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _Fo
return true;
// __first1 != __last1 && *__first1 != *__first2
- using _D1 = __iter_diff_t<_ForwardIterator1>;
+ using _D1 = __iterator_difference_type<_ForwardIterator1>;
_D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
if (__l1 == _D1(1))
return false;
@@ -173,10 +173,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
if (__first2 == __last2) // Second range is shorter
return false;
- using _D1 = __iter_diff_t<_Iter1>;
+ using _D1 = __iterator_difference_type<_Iter1>;
_D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
- using _D2 = __iter_diff_t<_Iter2>;
+ using _D2 = __iterator_difference_type<_Iter2>;
_D2 __l2 = _IterOps<_AlgPolicy>::distance(__first2, __last2);
if (__l1 != __l2)
return false;
diff --git a/libcxx/include/__algorithm/lexicographical_compare_three_way.h b/libcxx/include/__algorithm/lexicographical_compare_three_way.h
index a5872e9..442223e 100644
--- a/libcxx/include/__algorithm/lexicographical_compare_three_way.h
+++ b/libcxx/include/__algorithm/lexicographical_compare_three_way.h
@@ -37,13 +37,13 @@ template <class _InputIterator1, class _InputIterator2, class _Cmp>
_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_fast_path(
_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp)
-> decltype(__comp(*__first1, *__first2)) {
- static_assert(
- signed_integral<__iter_diff_t<_InputIterator1>>, "Using a non-integral difference_type is undefined behavior.");
- static_assert(
- signed_integral<__iter_diff_t<_InputIterator2>>, "Using a non-integral difference_type is undefined behavior.");
+ static_assert(signed_integral<__iterator_difference_type<_InputIterator1>>,
+ "Using a non-integral difference_type is undefined behavior.");
+ static_assert(signed_integral<__iterator_difference_type<_InputIterator2>>,
+ "Using a non-integral difference_type is undefined behavior.");
- using _Len1 = __iter_diff_t<_InputIterator1>;
- using _Len2 = __iter_diff_t<_InputIterator2>;
+ using _Len1 = __iterator_difference_type<_InputIterator1>;
+ using _Len2 = __iterator_difference_type<_InputIterator2>;
using _Common = common_type_t<_Len1, _Len2>;
_Len1 __len1 = __last1 - __first1;
diff --git a/libcxx/include/__algorithm/make_heap.h b/libcxx/include/__algorithm/make_heap.h
index 8aff8ce..f98a0d2 100644
--- a/libcxx/include/__algorithm/make_heap.h
+++ b/libcxx/include/__algorithm/make_heap.h
@@ -33,10 +33,10 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
__comp_ref_type<_Compare> __comp_ref = __comp;
- using __diff_t = __iter_diff_t<_RandomAccessIterator>;
+ using __diff_t = __iterator_difference_type<_RandomAccessIterator>;
const __diff_t __n = __last - __first;
- const bool __assume_both_children = is_arithmetic<__iter_value_type<_RandomAccessIterator> >::value;
+ const bool __assume_both_children = is_arithmetic<__iterator_value_type<_RandomAccessIterator> >::value;
// While it would be correct to always assume we have both children, in practice we observed this to be a performance
// improvement only for arithmetic types.
diff --git a/libcxx/include/__algorithm/mismatch.h b/libcxx/include/__algorithm/mismatch.h
index a683679..749c701 100644
--- a/libcxx/include/__algorithm/mismatch.h
+++ b/libcxx/include/__algorithm/mismatch.h
@@ -60,7 +60,7 @@ __mismatch(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Pred& __pred, _Pro
template <class _Iter>
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter, _Iter>
__mismatch_vectorized(_Iter __first1, _Iter __last1, _Iter __first2) {
- using __value_type = __iter_value_type<_Iter>;
+ using __value_type = __iterator_value_type<_Iter>;
constexpr size_t __unroll_count = 4;
constexpr size_t __vec_size = __native_vector_size<__value_type>;
using __vec = __simd_vector<__value_type, __vec_size>;
diff --git a/libcxx/include/__algorithm/move.h b/libcxx/include/__algorithm/move.h
index 73b780d..52bd5fb 100644
--- a/libcxx/include/__algorithm/move.h
+++ b/libcxx/include/__algorithm/move.h
@@ -80,7 +80,8 @@ struct __move_impl {
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
using _Traits = __segmented_iterator_traits<_OutIter>;
- using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
+ using _DiffT =
+ typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
if (__first == __last)
return std::make_pair(std::move(__first), std::move(__result));
diff --git a/libcxx/include/__algorithm/move_backward.h b/libcxx/include/__algorithm/move_backward.h
index e3e61c7b..a469832 100644
--- a/libcxx/include/__algorithm/move_backward.h
+++ b/libcxx/include/__algorithm/move_backward.h
@@ -86,7 +86,8 @@ struct __move_backward_impl {
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
using _Traits = __segmented_iterator_traits<_OutIter>;
- using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
+ using _DiffT =
+ typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
// When the range contains no elements, __result might not be a valid iterator
if (__first == __last)
diff --git a/libcxx/include/__algorithm/pstl.h b/libcxx/include/__algorithm/pstl.h
index aa7b49d..eea07e2 100644
--- a/libcxx/include/__algorithm/pstl.h
+++ b/libcxx/include/__algorithm/pstl.h
@@ -115,7 +115,7 @@ template <class _ExecutionPolicy,
class _Predicate,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
+_LIBCPP_HIDE_FROM_ABI __iterator_difference_type<_ForwardIterator>
count_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
_ForwardIterator, "count_if(first, last, pred) requires [first, last) to be ForwardIterators");
@@ -129,7 +129,7 @@ template <class _ExecutionPolicy,
class _Tp,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
+_LIBCPP_HIDE_FROM_ABI __iterator_difference_type<_ForwardIterator>
count(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
_ForwardIterator, "count(first, last, val) requires [first, last) to be ForwardIterators");
diff --git a/libcxx/include/__algorithm/radix_sort.h b/libcxx/include/__algorithm/radix_sort.h
index 055d8a0..5549a69 100644
--- a/libcxx/include/__algorithm/radix_sort.h
+++ b/libcxx/include/__algorithm/radix_sort.h
@@ -72,14 +72,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 14
template <class _InputIterator, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI constexpr pair<_OutputIterator, __iter_value_type<_InputIterator>>
+_LIBCPP_HIDE_FROM_ABI constexpr pair<_OutputIterator, __iterator_value_type<_InputIterator>>
__partial_sum_max(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
if (__first == __last)
return {__result, 0};
- auto __max = *__first;
- __iter_value_type<_InputIterator> __sum = *__first;
- *__result = __sum;
+ auto __max = *__first;
+ __iterator_value_type<_InputIterator> __sum = *__first;
+ *__result = __sum;
while (++__first != __last) {
if (__max < *__first) {
@@ -124,7 +124,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __nth_radix(size_t __radix_number, _Radix _
template <class _ForwardIterator, class _Map, class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI constexpr void
__collect(_ForwardIterator __first, _ForwardIterator __last, _Map __map, _RandomAccessIterator __counters) {
- using __value_type = __iter_value_type<_ForwardIterator>;
+ using __value_type = __iterator_value_type<_ForwardIterator>;
using __traits = __counting_sort_traits<__value_type, _Map>;
std::for_each(__first, __last, [&__counters, &__map](const auto& __preimage) { ++__counters[__map(__preimage)]; });
@@ -160,7 +160,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __collect_impl(
_RandomAccessIterator1 __counters,
_RandomAccessIterator2 __maximums,
index_sequence<_Radices...>) {
- using __value_type = __iter_value_type<_ForwardIterator>;
+ using __value_type = __iterator_value_type<_ForwardIterator>;
constexpr auto __radix_value_range = __radix_sort_traits<__value_type, _Map, _Radix>::__radix_value_range;
auto __previous = numeric_limits<__invoke_result_t<_Map, __value_type>>::min();
@@ -189,7 +189,7 @@ __collect(_ForwardIterator __first,
_Radix __radix,
_RandomAccessIterator1 __counters,
_RandomAccessIterator2 __maximums) {
- using __value_type = __iter_value_type<_ForwardIterator>;
+ using __value_type = __iterator_value_type<_ForwardIterator>;
constexpr auto __radix_count = __radix_sort_traits<__value_type, _Map, _Radix>::__radix_count;
return std::__collect_impl(
__first, __last, __map, __radix, __counters, __maximums, make_index_sequence<__radix_count>());
@@ -213,10 +213,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __dispose_backward(
template <class _ForwardIterator, class _RandomAccessIterator, class _Map>
_LIBCPP_HIDE_FROM_ABI constexpr _RandomAccessIterator
__counting_sort_impl(_ForwardIterator __first, _ForwardIterator __last, _RandomAccessIterator __result, _Map __map) {
- using __value_type = __iter_value_type<_ForwardIterator>;
+ using __value_type = __iterator_value_type<_ForwardIterator>;
using __traits = __counting_sort_traits<__value_type, _Map>;
- __iter_diff_t<_RandomAccessIterator> __counters[__traits::__value_range + 1] = {0};
+ __iterator_difference_type<_RandomAccessIterator> __counters[__traits::__value_range + 1] = {0};
std::__collect(__first, __last, __map, std::next(std::begin(__counters)));
std::__dispose(__first, __last, __result, __map, std::begin(__counters));
@@ -224,12 +224,13 @@ __counting_sort_impl(_ForwardIterator __first, _ForwardIterator __last, _RandomA
return __result + __counters[__traits::__value_range];
}
-template <class _RandomAccessIterator1,
- class _RandomAccessIterator2,
- class _Map,
- class _Radix,
- enable_if_t< __radix_sort_traits<__iter_value_type<_RandomAccessIterator1>, _Map, _Radix>::__radix_count == 1,
- int> = 0>
+template <
+ class _RandomAccessIterator1,
+ class _RandomAccessIterator2,
+ class _Map,
+ class _Radix,
+ enable_if_t<__radix_sort_traits<__iterator_value_type<_RandomAccessIterator1>, _Map, _Radix>::__radix_count == 1,
+ int> = 0>
_LIBCPP_HIDE_FROM_ABI constexpr void __radix_sort_impl(
_RandomAccessIterator1 __first,
_RandomAccessIterator1 __last,
@@ -243,24 +244,25 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __radix_sort_impl(
std::move(__buffer, __buffer_end, __first);
}
-template <
- class _RandomAccessIterator1,
- class _RandomAccessIterator2,
- class _Map,
- class _Radix,
- enable_if_t< __radix_sort_traits<__iter_value_type<_RandomAccessIterator1>, _Map, _Radix>::__radix_count % 2 == 0,
- int> = 0 >
+template <class _RandomAccessIterator1,
+ class _RandomAccessIterator2,
+ class _Map,
+ class _Radix,
+ enable_if_t<
+ __radix_sort_traits<__iterator_value_type<_RandomAccessIterator1>, _Map, _Radix>::__radix_count % 2 == 0,
+ int> = 0>
_LIBCPP_HIDE_FROM_ABI constexpr void __radix_sort_impl(
_RandomAccessIterator1 __first,
_RandomAccessIterator1 __last,
_RandomAccessIterator2 __buffer_begin,
_Map __map,
_Radix __radix) {
- using __value_type = __iter_value_type<_RandomAccessIterator1>;
+ using __value_type = __iterator_value_type<_RandomAccessIterator1>;
using __traits = __radix_sort_traits<__value_type, _Map, _Radix>;
- __iter_diff_t<_RandomAccessIterator1> __counters[__traits::__radix_count][__traits::__radix_value_range] = {{0}};
- __iter_diff_t<_RandomAccessIterator1> __maximums[__traits::__radix_count] = {0};
+ __iterator_difference_type<_RandomAccessIterator1>
+ __counters[__traits::__radix_count][__traits::__radix_value_range] = {{0}};
+ __iterator_difference_type<_RandomAccessIterator1> __maximums[__traits::__radix_count] = {0};
const auto __is_sorted = std::__collect(__first, __last, __map, __radix, __counters, __maximums);
if (!__is_sorted) {
const auto __range_size = std::distance(__first, __last);
diff --git a/libcxx/include/__algorithm/sift_down.h b/libcxx/include/__algorithm/sift_down.h
index e01c9b2..f827754 100644
--- a/libcxx/include/__algorithm/sift_down.h
+++ b/libcxx/include/__algorithm/sift_down.h
@@ -28,8 +28,8 @@ template <class _AlgPolicy, bool __assume_both_children, class _Compare, class _
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
__sift_down(_RandomAccessIterator __first,
_Compare&& __comp,
- __iter_diff_t<_RandomAccessIterator> __len,
- __iter_diff_t<_RandomAccessIterator> __start) {
+ __iterator_difference_type<_RandomAccessIterator> __len,
+ __iterator_difference_type<_RandomAccessIterator> __start) {
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
diff --git a/libcxx/include/__algorithm/stable_sort.h b/libcxx/include/__algorithm/stable_sort.h
index 1ca66f6..64c8080 100644
--- a/libcxx/include/__algorithm/stable_sort.h
+++ b/libcxx/include/__algorithm/stable_sort.h
@@ -247,7 +247,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void __stable_sort(
constexpr auto __default_comp = __desugars_to_v<__less_tag, _Compare, value_type, value_type >;
constexpr auto __radix_sortable =
__is_ordered_integer_representable_v<value_type> &&
- is_same_v< value_type&, __iter_reference<_RandomAccessIterator>>;
+ is_same_v< value_type&, __iterator_reference<_RandomAccessIterator>>;
if constexpr (__default_comp && __radix_sortable) {
if (__len <= __buff_size && __len >= static_cast<difference_type>(std::__radix_sort_min_bound<value_type>()) &&
__len <= static_cast<difference_type>(std::__radix_sort_max_bound<value_type>())) {