isBidirectionalRange fails for unknown reasons

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at
Wed Dec 16 18:47:09 PST 2015

On Wednesday, 16 December 2015 at 20:43:02 UTC, Jack Stouffer 
> ...

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() { return new 
typeof(this)(_payload); }
     final @property ref T back(){ return _payload.back; }
     final void popBack(){ _payload.popBack(); }

ReferenceBidirectionalRange!T is a subtype of 
ReferenceForwardRange!T, so the override is legal.

More information about the Digitalmars-d-learn mailing list