Skip to content

Commit 57bc803

Browse files
1 parent d4cc80f commit 57bc803

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

stl/inc/algorithm

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,11 @@ namespace ranges {
24262426
// |=======|????????|========|??????...
24272427

24282428
--_Mid2;
2429-
if (!_STD invoke(_Pred, _STD invoke(_Proj, *_Mid2), _Val)) { // mismatch; skip past it
2429+
if (_STD invoke(_Pred, _STD invoke(_Proj, *_Mid2), _Val)) {
2430+
if (_Mid2 == _Mid1) { // [_Mid1, _Mid2) is empty, so [_First, _Last) all match
2431+
return {_STD move(_First), _STD move(_Last)};
2432+
}
2433+
} else { // mismatch; skip past it
24302434
++_Mid2;
24312435
const auto _Delta = _RANGES distance(_First, _Mid2);
24322436

@@ -2441,11 +2445,6 @@ namespace ranges {
24412445
_Mid1 = _Last;
24422446
_RANGES advance(_Last, _Delta);
24432447
_Mid2 = _Last;
2444-
continue;
2445-
}
2446-
2447-
if (_Mid2 == _Mid1) { // [_Mid1, _Mid2) is empty, so [_First, _Last) all match
2448-
return {_STD move(_First), _STD move(_Last)};
24492448
}
24502449
}
24512450
} else {

0 commit comments

Comments
 (0)