mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
Quick updates to std.algorithm: Unquals in a few places to work w/ const ranges, re-add save() to Filter.
This commit is contained in:
parent
98aec1ce64
commit
7ca87c26ac
1 changed files with 12 additions and 4 deletions
|
@ -114,8 +114,8 @@ struct Map(alias fun, Range) if (isInputRange!(Range))
|
|||
{
|
||||
alias fun _fun;
|
||||
alias typeof({ return _fun(.ElementType!(Range).init); }()) ElementType;
|
||||
Range _input;
|
||||
ElementType _cache;
|
||||
Unqual!Range _input;
|
||||
Unqual!ElementType _cache;
|
||||
|
||||
static if (isBidirectionalRange!(Range))
|
||||
{
|
||||
|
@ -724,7 +724,7 @@ filter(alias pred, Range)(Range rs)
|
|||
|
||||
struct Filter(alias pred, Range) if (isInputRange!(Range))
|
||||
{
|
||||
Range _input;
|
||||
Unqual!Range _input;
|
||||
|
||||
this(Range r)
|
||||
{
|
||||
|
@ -750,6 +750,14 @@ struct Filter(alias pred, Range) if (isInputRange!(Range))
|
|||
{
|
||||
return _input.front;
|
||||
}
|
||||
|
||||
static if(isForwardRange!Range)
|
||||
{
|
||||
@property typeof(this) save()
|
||||
{
|
||||
return typeof(this)(_input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unittest
|
||||
|
@ -1504,7 +1512,7 @@ unittest
|
|||
|
||||
// joiner
|
||||
/**
|
||||
Lazily joins a range of ranges with a separator. The range of ranges
|
||||
Lazily joins a range of ranges with a separator. The range of ranges
|
||||
|
||||
Example:
|
||||
----
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue