This is basically a sibling of #4102.
|
template <bidirectional_iterator _It>
|
|
void _Rotate_one_right(_It _First, _It _Mid, _It _Last) {
|
|
// exchanges the range [_First, _Mid) with [_Mid, _Last)
|
|
_STL_INTERNAL_CHECK(_RANGES next(_Mid) == _Last);
|
|
auto _Temp = _RANGES iter_move(_Mid);
|
|
_RANGES _Move_backward_common(_First, _STD move(_Mid), _STD move(_Last));
|
|
*_First = _STD move(_Temp);
|
|
}
|
|
|
|
template <bidirectional_iterator _It>
|
|
void _Rotate_one_left(_It _First, _It _Mid, _It _Last) {
|
|
// exchanges the range [_First, _Mid) with [_Mid, _Last)
|
|
_STL_INTERNAL_CHECK(_RANGES next(_First) == _Mid);
|
|
auto _Temp = _RANGES iter_move(_First);
|
|
auto _Result = _RANGES _Move_unchecked(_STD move(_Mid), _STD move(_Last), _STD move(_First));
|
|
*_Result.out = _STD move(_Temp);
|
|
}
|
auto _Temp = _RANGES iter_move(_Mid) unexpectedly constructed remove_cvref_t<iter_reference_t<I>>.
Contrived testcase: https://godbolt.org/z/b7YqKPMej
This is basically a sibling of #4102.
STL/stl/inc/algorithm
Lines 7614 to 7630 in 1c59a20
auto _Temp = _RANGES iter_move(_Mid)unexpectedly constructedremove_cvref_t<iter_reference_t<I>>.Contrived testcase: https://godbolt.org/z/b7YqKPMej