mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 16:10:45 +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 fun _fun;
|
||||||
alias typeof({ return _fun(.ElementType!(Range).init); }()) ElementType;
|
alias typeof({ return _fun(.ElementType!(Range).init); }()) ElementType;
|
||||||
Range _input;
|
Unqual!Range _input;
|
||||||
ElementType _cache;
|
Unqual!ElementType _cache;
|
||||||
|
|
||||||
static if (isBidirectionalRange!(Range))
|
static if (isBidirectionalRange!(Range))
|
||||||
{
|
{
|
||||||
|
@ -724,7 +724,7 @@ filter(alias pred, Range)(Range rs)
|
||||||
|
|
||||||
struct Filter(alias pred, Range) if (isInputRange!(Range))
|
struct Filter(alias pred, Range) if (isInputRange!(Range))
|
||||||
{
|
{
|
||||||
Range _input;
|
Unqual!Range _input;
|
||||||
|
|
||||||
this(Range r)
|
this(Range r)
|
||||||
{
|
{
|
||||||
|
@ -750,6 +750,14 @@ struct Filter(alias pred, Range) if (isInputRange!(Range))
|
||||||
{
|
{
|
||||||
return _input.front;
|
return _input.front;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static if(isForwardRange!Range)
|
||||||
|
{
|
||||||
|
@property typeof(this) save()
|
||||||
|
{
|
||||||
|
return typeof(this)(_input);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
|
@ -1504,7 +1512,7 @@ unittest
|
||||||
|
|
||||||
// joiner
|
// 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:
|
Example:
|
||||||
----
|
----
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue