mirror of
https://github.com/dlang/phobos.git
synced 2025-05-06 11:07:39 +03:00
Fix a few minor, unlisted bugs in InputRangeObject.
This commit is contained in:
parent
5264901ff4
commit
91bc314e2d
1 changed files with 9 additions and 3 deletions
|
@ -4935,7 +4935,7 @@ template InputRangeObject(R) if(isInputRange!(Unqual!R)) {
|
||||||
|
|
||||||
static if(isForwardRange!R) {
|
static if(isForwardRange!R) {
|
||||||
@property typeof(this) save() {
|
@property typeof(this) save() {
|
||||||
return new typeof(this)(_range);
|
return new typeof(this)(_range.save);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5029,8 +5029,12 @@ template InputRangeObject(R) if(isInputRange!(Unqual!R)) {
|
||||||
|
|
||||||
/**Convenience function for creating a $(D InputRangeObject) of the proper type.*/
|
/**Convenience function for creating a $(D InputRangeObject) of the proper type.*/
|
||||||
InputRangeObject!R inputRangeObject(R)(R range) if(isInputRange!R) {
|
InputRangeObject!R inputRangeObject(R)(R range) if(isInputRange!R) {
|
||||||
|
static if(is(R : InputRange!(ElementType!R))) {
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
return new InputRangeObject!R(range);
|
return new InputRangeObject!R(range);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**Convenience function for creating a $(D OutputRangeObject) with a base range
|
/**Convenience function for creating a $(D OutputRangeObject) with a base range
|
||||||
* of type $(D R) that accepts types $(D E).
|
* of type $(D R) that accepts types $(D E).
|
||||||
|
@ -5071,6 +5075,8 @@ unittest {
|
||||||
foreach(elem; arrWrapped) {}
|
foreach(elem; arrWrapped) {}
|
||||||
foreach(i, elem; arrWrapped) {}
|
foreach(i, elem; arrWrapped) {}
|
||||||
|
|
||||||
|
assert(inputRangeObject(arrWrapped) is arrWrapped);
|
||||||
|
|
||||||
foreach(DummyType; AllDummyRanges) {
|
foreach(DummyType; AllDummyRanges) {
|
||||||
auto d = DummyType.init;
|
auto d = DummyType.init;
|
||||||
static assert(propagatesRangeType!(DummyType,
|
static assert(propagatesRangeType!(DummyType,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue