@@ -89,28 +89,28 @@ struct _IterOps<_ClassicAlgPolicy> {
89
89
// advance with sentinel, a la std::ranges::advance
90
90
// it's unclear whether _Iter has a difference_type and whether that's signed, so we play it safe:
91
91
// use the incoming type for returning and steer clear of negative overflows
92
- template <class _Iter , class _Distance >
93
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static _Distance
94
- __advance_to (_Iter& __iter, _Distance __count, const _Iter& __sentinel) {
92
+ template <class _Iter >
93
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __difference_type<_Iter>
94
+ __advance_to (_Iter& __iter, __difference_type<_Iter> __count, const _Iter& __sentinel) {
95
95
return _IterOps::__advance_to (__iter, __count, __sentinel, typename iterator_traits<_Iter>::iterator_category ());
96
96
}
97
97
98
98
private:
99
99
// advance with sentinel, a la std::ranges::advance -- InputIterator specialization
100
- template <class _InputIter , class _Distance >
101
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static _Distance
102
- __advance_to (_InputIter& __iter, _Distance __count, const _InputIter& __sentinel, input_iterator_tag) {
103
- _Distance __dist = _Distance () ;
100
+ template <class _InputIter >
101
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __difference_type<_InputIter>
102
+ __advance_to (_InputIter& __iter, __difference_type<_InputIter> __count, const _InputIter& __sentinel, input_iterator_tag) {
103
+ __difference_type<_InputIter> __dist = 0 ;
104
104
for (; __dist < __count && __iter != __sentinel; ++__dist)
105
105
++__iter;
106
106
return __count - __dist;
107
107
}
108
108
109
109
// advance with sentinel, a la std::ranges::advance -- BidirectionalIterator specialization
110
- template <class _BiDirIter , class _Distance >
111
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static _Distance
112
- __advance_to (_BiDirIter& __iter, _Distance __count, const _BiDirIter& __sentinel, bidirectional_iterator_tag) {
113
- _Distance __dist = _Distance () ;
110
+ template <class _BiDirIter >
111
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __difference_type<_BiDirIter>
112
+ __advance_to (_BiDirIter& __iter, __difference_type<_BiDirIter> __count, const _BiDirIter& __sentinel, bidirectional_iterator_tag) {
113
+ __difference_type<_BiDirIter> __dist = 0 ;
114
114
if (__count >= 0 )
115
115
for (; __dist < __count && __iter != __sentinel; ++__dist)
116
116
++__iter;
@@ -121,9 +121,9 @@ struct _IterOps<_ClassicAlgPolicy> {
121
121
}
122
122
123
123
// advance with sentinel, a la std::ranges::advance -- RandomIterator specialization
124
- template <class _RandIter , class _Distance >
125
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static _Distance
126
- __advance_to (_RandIter& __iter, _Distance __count, const _RandIter& __sentinel, random_access_iterator_tag) {
124
+ template <class _RandIter >
125
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __difference_type<_RandIter>
126
+ __advance_to (_RandIter& __iter, __difference_type<_RandIter> __count, const _RandIter& __sentinel, random_access_iterator_tag) {
127
127
auto __dist = _IterOps::distance (__iter, __sentinel);
128
128
_LIBCPP_ASSERT_VALID_INPUT_RANGE (
129
129
__count == 0 || (__dist < 0 ) == (__count < 0 ), " __sentinel must precede __iter when __count < 0" );
0 commit comments