mirror of
https://github.com/dlang/phobos.git
synced 2025-05-03 08:30:33 +03:00
Mehrdad's first commit, mainly as a test. Changed filter()'s structure to FilteredRange to give better error messages.
This commit is contained in:
parent
98b34a285a
commit
66c886a4f1
1 changed files with 3 additions and 3 deletions
|
@ -1078,7 +1078,7 @@ template filter(alias pred) if (is(typeof(unaryFun!pred)))
|
||||||
{
|
{
|
||||||
auto filter(Range)(Range rs) if (isInputRange!(Unqual!Range))
|
auto filter(Range)(Range rs) if (isInputRange!(Unqual!Range))
|
||||||
{
|
{
|
||||||
struct Result
|
struct FilteredRange
|
||||||
{
|
{
|
||||||
alias Unqual!Range R;
|
alias Unqual!Range R;
|
||||||
R _input;
|
R _input;
|
||||||
|
@ -1120,12 +1120,12 @@ template filter(alias pred) if (is(typeof(unaryFun!pred)))
|
||||||
{
|
{
|
||||||
@property auto save()
|
@property auto save()
|
||||||
{
|
{
|
||||||
return Result(_input);
|
return typeof(this)(_input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result(rs);
|
return FilteredRange(rs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue