Fix a few minor, unlisted bugs in InputRangeObject.

This commit is contained in:
David Simcha 2010-11-08 03:07:54 +00:00
parent 5264901ff4
commit 91bc314e2d

View file

@ -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,7 +5029,11 @@ 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) {
return new InputRangeObject!R(range); static if(is(R : InputRange!(ElementType!R))) {
return range;
} else {
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
@ -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,