Always return range.save

This commit is contained in:
Andrei Alexandrescu 2016-01-11 13:32:30 -05:00
parent d95d96f05d
commit a505de3b51

View file

@ -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