isBidirectionalRange fails for unknown reasons

Jack Stouffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 16 13:56:54 PST 2015


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 
> isForwardRange!(ReferenceBidirectionalRange!T) fail, and 
> everything that depends on it.
>
> You can override `save` in ReferenceBidirectionalRange or try 
> something clever like using a template this parameter:
>
> @property auto save(this This)() {return new This( _payload);}

Thanks! That did the trick.


More information about the Digitalmars-d-learn mailing list