Only define Until.save() forward ranges

std.algorithm.Until.save() was defined for all ranges, but should only
be defined when the underlying range is a forward range.
This commit is contained in:
Lars T. Kyllingstad 2011-05-16 15:36:01 +02:00
parent 3b628aeb50
commit dc352eaec9

View file

@ -3655,29 +3655,32 @@ struct Until(alias pred, Range, Sentinel) if (isInputRange!Range)
}
}
static if (!is(Sentinel == void))
@property Until save()
{
Until result;
static if (isForwardRange!Range)
{
static if (!is(Sentinel == void))
@property Until save()
{
Until result;
result._input = _input.save;
result._sentinel = _sentinel;
result._openRight = _openRight;
result._done = _done;
result._input = _input.save;
result._sentinel = _sentinel;
result._openRight = _openRight;
result._done = _done;
return result;
}
else
@property Until save()
{
Until result;
return result;
}
else
@property Until save()
{
Until result;
result._input = _input.save;
result._openRight = _openRight;
result._done = _done;
result._input = _input.save;
result._openRight = _openRight;
result._done = _done;
return result;
}
return result;
}
}
}
/// Ditto