mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 22:50:38 +03:00
Always return range.save
This commit is contained in:
parent
d95d96f05d
commit
a505de3b51
1 changed files with 3 additions and 2 deletions
|
@ -2918,11 +2918,12 @@ Range minPos(alias pred = "a < b", Range)(Range range)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (range.empty) return range;
|
||||
auto result = range.save;
|
||||
if (range.empty) return result;
|
||||
for (range.popFront(); !range.empty; range.popFront())
|
||||
{
|
||||
//Note: Unlike minCount, we do not care to find equivalence, so a single pred call is enough
|
||||
// Note: Unlike minCount, we do not care to find equivalence, so a
|
||||
// single pred call is enough.
|
||||
if (binaryFun!pred(range.front, result.front))
|
||||
{
|
||||
// change the min
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue