@@ -3430,6 +3430,11 @@ _FwdIt2 swap_ranges(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _Dest) noe
34303430}
34313431#endif // _HAS_CXX17
34323432
3433+ _EXPORT_STD template <class _FwdIt1, class _FwdIt2>
3434+ _CONSTEXPR20 void iter_swap(_FwdIt1 _Left, _FwdIt2 _Right) { // swap *_Left and *_Right
3435+ swap(*_Left, *_Right); // intentional ADL
3436+ }
3437+
34333438_EXPORT_STD template <class _InIt, class _OutIt, class _Fn>
34343439_CONSTEXPR20 _OutIt transform(const _InIt _First, const _InIt _Last, _OutIt _Dest, _Fn _Func) {
34353440 // transform [_First, _Last) with _Func
@@ -5349,7 +5354,7 @@ void _Random_shuffle1(_RanIt _First, _RanIt _Last, _RngFn& _RngFunc) {
53495354 _Diff _Off = _RngFunc(static_cast<_Diff>(_Target_index + 1));
53505355 _STL_ASSERT(0 <= _Off && _Off <= _Target_index, "random value out of range");
53515356 if (_Off != _Target_index) { // avoid self-move-assignment
5352- _STD iter_swap( _UTarget, _UFirst + _Off);
5357+ swap(* _UTarget, *( _UFirst + _Off)); // intentional ADL
53535358 }
53545359 }
53555360}
@@ -5559,7 +5564,7 @@ constexpr _FwdIt shift_right(_FwdIt _First, const _FwdIt _Last, _Iter_diff_t<_Fw
55595564
55605565 return _First;
55615566 }
5562- _Swap_adl (*_Mid, *_Trail);
5567+ swap (*_Mid, *_Trail); // intentional ADL
55635568 }
55645569 }
55655570 }
@@ -5830,7 +5835,7 @@ _CONSTEXPR20 _FwdIt partition(_FwdIt _First, const _FwdIt _Last, _Pr _Pred) {
58305835 }
58315836 } while (!_Pred(*_ULast));
58325837
5833- _STD iter_swap( _UFirst, _ULast); // out of place, swap and loop
5838+ swap(* _UFirst, * _ULast); // out of place, swap and loop; intentional ADL
58345839 ++_UFirst;
58355840 }
58365841 } else {
@@ -5849,7 +5854,7 @@ _CONSTEXPR20 _FwdIt partition(_FwdIt _First, const _FwdIt _Last, _Pr _Pred) {
58495854
58505855 for (auto _UNext = _UFirst; ++_UNext != _ULast;) {
58515856 if (_Pred(*_UNext)) {
5852- _STD iter_swap( _UFirst, _UNext); // out of place, swap and loop
5857+ swap(* _UFirst, * _UNext); // out of place, swap and loop; intentional ADL
58535858 ++_UFirst;
58545859 }
58555860 }
@@ -7924,14 +7929,14 @@ template <class _RanIt, class _Pr>
79247929_CONSTEXPR20 void _Med3_unchecked(_RanIt _First, _RanIt _Mid, _RanIt _Last, _Pr _Pred) {
79257930 // sort median of three elements to middle
79267931 if (_DEBUG_LT_PRED(_Pred, *_Mid, *_First)) {
7927- _STD iter_swap( _Mid, _First);
7932+ swap(* _Mid, * _First); // intentional ADL
79287933 }
79297934
79307935 if (_DEBUG_LT_PRED(_Pred, *_Last, *_Mid)) { // swap middle and last, then test first again
7931- _STD iter_swap( _Last, _Mid);
7936+ swap(* _Last, * _Mid); // intentional ADL
79327937
79337938 if (_DEBUG_LT_PRED(_Pred, *_Mid, *_First)) {
7934- _STD iter_swap( _Mid, _First);
7939+ swap(* _Mid, * _First); // intentional ADL
79357940 }
79367941 }
79377942}
@@ -7980,20 +7985,21 @@ _CONSTEXPR20 pair<_RanIt, _RanIt> _Partition_by_median_guess_unchecked(_RanIt _F
79807985 } else if (_Pred(*_Gfirst, *_Pfirst)) {
79817986 break;
79827987 } else if (_Plast != _Gfirst) {
7983- _STD iter_swap( _Plast, _Gfirst);
7988+ swap(* _Plast, * _Gfirst); // intentional ADL
79847989 ++_Plast;
79857990 } else {
79867991 ++_Plast;
79877992 }
79887993 }
79897994
79907995 for (; _First < _Glast; --_Glast) {
7991- if (_DEBUG_LT_PRED(_Pred, *_Prev_iter(_Glast), *_Pfirst)) {
7996+ const auto _Glast_prev = _Prev_iter(_Glast);
7997+ if (_DEBUG_LT_PRED(_Pred, *_Glast_prev, *_Pfirst)) {
79927998 continue;
7993- } else if (_Pred(*_Pfirst, *_Prev_iter(_Glast) )) {
7999+ } else if (_Pred(*_Pfirst, *_Glast_prev )) {
79948000 break;
7995- } else if (--_Pfirst != _Prev_iter(_Glast) ) {
7996- _STD iter_swap( _Pfirst, _Prev_iter(_Glast));
8001+ } else if (--_Pfirst != _Glast_prev ) {
8002+ swap(* _Pfirst, *_Glast_prev); // intentional ADL
79978003 }
79988004 }
79998005
@@ -8003,21 +8009,21 @@ _CONSTEXPR20 pair<_RanIt, _RanIt> _Partition_by_median_guess_unchecked(_RanIt _F
80038009
80048010 if (_Glast == _First) { // no room at bottom, rotate pivot upward
80058011 if (_Plast != _Gfirst) {
8006- _STD iter_swap( _Pfirst, _Plast);
8012+ swap(* _Pfirst, * _Plast); // intentional ADL
80078013 }
80088014
80098015 ++_Plast;
8010- _STD iter_swap( _Pfirst, _Gfirst);
8016+ swap(* _Pfirst, * _Gfirst); // intentional ADL
80118017 ++_Pfirst;
80128018 ++_Gfirst;
80138019 } else if (_Gfirst == _Last) { // no room at top, rotate pivot downward
80148020 if (--_Glast != --_Pfirst) {
8015- _STD iter_swap( _Glast, _Pfirst);
8021+ swap(* _Glast, * _Pfirst); // intentional ADL
80168022 }
80178023
8018- _STD iter_swap( _Pfirst, --_Plast);
8024+ swap(* _Pfirst, * --_Plast); // intentional ADL
80198025 } else {
8020- _STD iter_swap( _Gfirst, --_Glast);
8026+ swap(* _Gfirst, * --_Glast); // intentional ADL
80218027 ++_Gfirst;
80228028 }
80238029 }
@@ -10217,7 +10223,7 @@ _CONSTEXPR20 bool next_permutation(_BidIt _First, _BidIt _Last, _Pr _Pred) {
1021710223 --_UMid;
1021810224 } while (!_DEBUG_LT_PRED(_Pred, *_UNext, *_UMid));
1021910225
10220- _STD iter_swap( _UNext, _UMid);
10226+ swap(* _UNext, * _UMid); // intentional ADL
1022110227 _STD reverse(_UNext1, _ULast);
1022210228 return true;
1022310229 }
@@ -10321,7 +10327,7 @@ _CONSTEXPR20 bool prev_permutation(_BidIt _First, _BidIt _Last, _Pr _Pred) {
1032110327 --_UMid;
1032210328 } while (!_DEBUG_LT_PRED(_Pred, *_UMid, *_UNext));
1032310329
10324- _STD iter_swap( _UNext, _UMid);
10330+ swap(* _UNext, * _UMid); // intentional ADL
1032510331 _STD reverse(_UNext1, _ULast);
1032610332 return true;
1032710333 }
0 commit comments