mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 23:20:29 +03:00
No need to test if range is empty in minPos
This commit is contained in:
parent
19288618af
commit
d95d96f05d
1 changed files with 1 additions and 2 deletions
|
@ -2903,8 +2903,6 @@ Range minPos(alias pred = "a < b", Range)(Range range)
|
|||
if (isForwardRange!Range && !isInfinite!Range &&
|
||||
is(typeof(binaryFun!pred(range.front, range.front))))
|
||||
{
|
||||
if (range.empty) return range;
|
||||
|
||||
static if (hasSlicing!Range && isRandomAccessRange!Range && hasLength!Range)
|
||||
{
|
||||
// Prefer index-based access
|
||||
|
@ -2920,6 +2918,7 @@ Range minPos(alias pred = "a < b", Range)(Range range)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (range.empty) return range;
|
||||
auto result = range.save;
|
||||
for (range.popFront(); !range.empty; range.popFront())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue