Difference between input range and forward range

Tobias Pankrath via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 12 09:56:38 PST 2015


On Thursday, 12 November 2015 at 15:43:50 UTC, Jonathan M Davis 
wrote:
> On Thursday, 12 November 2015 at 15:29:19 UTC, Steven 
> Schveighoffer wrote:
>> (and diabolically, 99% of the time it DOES do what you want).
>
> _This_ is the big problem. It wouldn't surprise me in the least 
> if the vast majority of range-based code out there does not 
> actually work properly with ranges which aren't implicitly 
> saved when they're copied. I mean, technically, you have to do 
> stuff like haystack.save.startsWith(needle) instead of 
> haystack.startsWith(needle) if you want your code to work right 
> with all forward ranges, but almost no one does that. And 99% 
> of the time the code works - but not always.
>
> - Jonathan M Davis

https://issues.dlang.org/show_bug.cgi?id=11951


More information about the Digitalmars-d mailing list