Skip to content

Commit

Permalink
Always return range.save
Browse files Browse the repository at this point in the history
  • Loading branch information
andralex committed Jan 11, 2016
1 parent d95d96f commit a505de3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions std/algorithm/searching.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a505de3

Please sign in to comment.