Difference between input range and forward range

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 12 07:43:48 PST 2015


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



More information about the Digitalmars-d mailing list