Transience of .front in input vs. forward ranges

deadalnix deadalnix at gmail.com
Mon Nov 5 07:24:22 PST 2012


Le 05/11/2012 04:21, Jonathan M Davis a écrit :
> However, that means that we need to be very clear about the fact that input
> ranges can have transient fronts and that algorithms cannot assume that their
> fronts are not transient (something that only you appear to have thought was
> clear).

Note that this break inputRange.array(); Which seems like a really big 
problem to me.

> We then either have to change a bunch of algorithms so that they
> require forward ranges, or we need to create a trait which can determine
> whether front is transient in it least some cases (it would still be claiming
> that front is transient in some cases where it isn't, because it can't know
> for sure, but we'd at least be able to figure it out in some cases), and make
> algorithms use that in their constraints when they deal with input ranges.
> std.array.array would be a prime case where an algorithm would have to be
> changed, because it can't function with a transient front, and it's a prime
> example of a function that you'd normally expect to work with an input range.
> And this _will_ break code. It'll allow us to fix the ByLine problem though.
>
> - Jonathan M Davis



More information about the Digitalmars-d mailing list