Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 20:43:02 UTC, Jack Stouffer wrote: unittest { static assert(isInputRange!(ReferenceInputRange!int)); // works static assert(isForwardRange!(ReferenceForwardRange!int)); // works static

isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
I'm trying to add a ReferenceBidirectionalRange range type to std.internal.test.dummyrange so I can test some range code I'm writing, but I've hit a wall and I'm not sure why. For some reason, the isBidirectionalRange check fails even though back and popBack are present. Any help here would be

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread anonymous via Digitalmars-d-learn
On 16.12.2015 21:43, Jack Stouffer wrote: I'm trying to add a ReferenceBidirectionalRange range type to std.internal.test.dummyrange so I can test some range code I'm writing, but I've hit a wall and I'm not sure why. For some reason, the isBidirectionalRange check fails even though back and

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 21:40:44 UTC, anonymous wrote: The `.save` primitive of forward ranges must return the very same type that the range has. But your ReferenceBidirectionalRange!T.save returns a ReferenceForwardRange!T, because it's inherited. That makes

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 20:43:02 UTC, Jack Stouffer wrote: ... You can also use return type covariance: class ReferenceBidirectionalRange(T) : ReferenceForwardRange!T { this(Range)(Range r) if (isInputRange!Range) { super(r); } final override @property typeof(this) save() {