Mehrdad's first commit, mainly as a test. Changed filter()'s structure to FilteredRange to give better error messages.

This commit is contained in:
Lambert 2012-05-11 16:20:26 -07:00
parent 98b34a285a
commit 66c886a4f1

View file

@ -1078,7 +1078,7 @@ template filter(alias pred) if (is(typeof(unaryFun!pred)))
{
auto filter(Range)(Range rs) if (isInputRange!(Unqual!Range))
{
struct Result
struct FilteredRange
{
alias Unqual!Range R;
R _input;
@ -1120,12 +1120,12 @@ template filter(alias pred) if (is(typeof(unaryFun!pred)))
{
@property auto save()
{
return Result(_input);
return typeof(this)(_input);
}
}
}
return Result(rs);
return FilteredRange(rs);
}
}