Skip to content

Commit 26a07e6

Browse files
committed
[libc++] Make the naming of the iterator_traits aliases consistent
1 parent 4b05a12 commit 26a07e6

37 files changed

+190
-180
lines changed

libcxx/include/__algorithm/copy.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ struct __copy_impl {
197197
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
198198
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
199199
using _Traits = __segmented_iterator_traits<_OutIter>;
200-
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
200+
using _DiffT =
201+
typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
201202

202203
if (__first == __last)
203204
return std::make_pair(std::move(__first), std::move(__result));

libcxx/include/__algorithm/copy_backward.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ struct __copy_backward_impl {
214214

215215
auto __local_last = _Traits::__local(__result);
216216
while (true) {
217-
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
217+
using _DiffT =
218+
typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
218219

219220
auto __local_first = _Traits::__begin(__segment_iterator);
220221
auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);

libcxx/include/__algorithm/count.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ __count_bool(__bit_iterator<_Cp, _IsConst> __first, typename __size_difference_t
7272
}
7373

7474
template <class, class _Cp, bool _IsConst, class _Tp, class _Proj, __enable_if_t<__is_identity<_Proj>::value, int> = 0>
75-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<__bit_iterator<_Cp, _IsConst> >
75+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iterator_difference_type<__bit_iterator<_Cp, _IsConst> >
7676
__count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value, _Proj&) {
7777
if (__value)
7878
return std::__count_bool<true>(
@@ -82,7 +82,8 @@ __count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __l
8282
}
8383

8484
template <class _InputIterator, class _Tp>
85-
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<_InputIterator>
85+
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
86+
_LIBCPP_CONSTEXPR_SINCE_CXX20 __iterator_difference_type<_InputIterator>
8687
count(_InputIterator __first, _InputIterator __last, const _Tp& __value) {
8788
__identity __proj;
8889
return std::__count<_ClassicAlgPolicy>(__first, __last, __value, __proj);

libcxx/include/__algorithm/is_permutation.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation_impl(
7878
_Pred&& __pred,
7979
_Proj1&& __proj1,
8080
_Proj2&& __proj2) {
81-
using _D1 = __iter_diff_t<_Iter1>;
81+
using _D1 = __iterator_difference_type<_Iter1>;
8282

8383
for (auto __i = __first1; __i != __last1; ++__i) {
8484
// Have we already counted the number of *__i in [f1, l1)?
@@ -126,7 +126,7 @@ template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _Fo
126126
return true;
127127

128128
// __first1 != __last1 && *__first1 != *__first2
129-
using _D1 = __iter_diff_t<_ForwardIterator1>;
129+
using _D1 = __iterator_difference_type<_ForwardIterator1>;
130130
_D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
131131
if (__l1 == _D1(1))
132132
return false;
@@ -173,10 +173,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
173173
if (__first2 == __last2) // Second range is shorter
174174
return false;
175175

176-
using _D1 = __iter_diff_t<_Iter1>;
176+
using _D1 = __iterator_difference_type<_Iter1>;
177177
_D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
178178

179-
using _D2 = __iter_diff_t<_Iter2>;
179+
using _D2 = __iterator_difference_type<_Iter2>;
180180
_D2 __l2 = _IterOps<_AlgPolicy>::distance(__first2, __last2);
181181
if (__l1 != __l2)
182182
return false;

libcxx/include/__algorithm/lexicographical_compare_three_way.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ template <class _InputIterator1, class _InputIterator2, class _Cmp>
3737
_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_fast_path(
3838
_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp)
3939
-> decltype(__comp(*__first1, *__first2)) {
40-
static_assert(
41-
signed_integral<__iter_diff_t<_InputIterator1>>, "Using a non-integral difference_type is undefined behavior.");
42-
static_assert(
43-
signed_integral<__iter_diff_t<_InputIterator2>>, "Using a non-integral difference_type is undefined behavior.");
40+
static_assert(signed_integral<__iterator_difference_type<_InputIterator1>>,
41+
"Using a non-integral difference_type is undefined behavior.");
42+
static_assert(signed_integral<__iterator_difference_type<_InputIterator2>>,
43+
"Using a non-integral difference_type is undefined behavior.");
4444

45-
using _Len1 = __iter_diff_t<_InputIterator1>;
46-
using _Len2 = __iter_diff_t<_InputIterator2>;
45+
using _Len1 = __iterator_difference_type<_InputIterator1>;
46+
using _Len2 = __iterator_difference_type<_InputIterator2>;
4747
using _Common = common_type_t<_Len1, _Len2>;
4848

4949
_Len1 __len1 = __last1 - __first1;

libcxx/include/__algorithm/make_heap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
3333
__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
3434
__comp_ref_type<_Compare> __comp_ref = __comp;
3535

36-
using __diff_t = __iter_diff_t<_RandomAccessIterator>;
36+
using __diff_t = __iterator_difference_type<_RandomAccessIterator>;
3737
const __diff_t __n = __last - __first;
3838

39-
const bool __assume_both_children = is_arithmetic<__iter_value_type<_RandomAccessIterator> >::value;
39+
const bool __assume_both_children = is_arithmetic<__iterator_value_type<_RandomAccessIterator> >::value;
4040

4141
// While it would be correct to always assume we have both children, in practice we observed this to be a performance
4242
// improvement only for arithmetic types.

libcxx/include/__algorithm/mismatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ __mismatch(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Pred& __pred, _Pro
6060
template <class _Iter>
6161
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter, _Iter>
6262
__mismatch_vectorized(_Iter __first1, _Iter __last1, _Iter __first2) {
63-
using __value_type = __iter_value_type<_Iter>;
63+
using __value_type = __iterator_value_type<_Iter>;
6464
constexpr size_t __unroll_count = 4;
6565
constexpr size_t __vec_size = __native_vector_size<__value_type>;
6666
using __vec = __simd_vector<__value_type, __vec_size>;

libcxx/include/__algorithm/move.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ struct __move_impl {
8080
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
8181
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
8282
using _Traits = __segmented_iterator_traits<_OutIter>;
83-
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
83+
using _DiffT =
84+
typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
8485

8586
if (__first == __last)
8687
return std::make_pair(std::move(__first), std::move(__result));

libcxx/include/__algorithm/move_backward.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ struct __move_backward_impl {
8686
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
8787
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
8888
using _Traits = __segmented_iterator_traits<_OutIter>;
89-
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
89+
using _DiffT =
90+
typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
9091

9192
// When the range contains no elements, __result might not be a valid iterator
9293
if (__first == __last)

libcxx/include/__algorithm/pstl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ template <class _ExecutionPolicy,
115115
class _Predicate,
116116
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
117117
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
118-
_LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
118+
_LIBCPP_HIDE_FROM_ABI __iterator_difference_type<_ForwardIterator>
119119
count_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
120120
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
121121
_ForwardIterator, "count_if(first, last, pred) requires [first, last) to be ForwardIterators");
@@ -129,7 +129,7 @@ template <class _ExecutionPolicy,
129129
class _Tp,
130130
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
131131
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
132-
_LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
132+
_LIBCPP_HIDE_FROM_ABI __iterator_difference_type<_ForwardIterator>
133133
count(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
134134
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
135135
_ForwardIterator, "count(first, last, val) requires [first, last) to be ForwardIterators");

0 commit comments

Comments
 (0)