I'm back

jerro a at a.com
Fri Nov 23 07:34:51 PST 2012


> What if we did it so that transient ranges would have to define 
> transient property (as was previously proposed), and 
> isInputRange, isForwardRange and others would get an additional 
> parameter allowTransient. The default value of that argument 
> would be false, so those templates would evaluate to false for 
> transient ranges by default. Then algorithms that can work with 
> transient ranges would use
> ...
> if(isInputRange!(R, true))
>
> instead of
>
> if(isInputRange!R)
>
> The algorithms that don't support transient ranges would not 
> need to be changed.  Wrapper ranges such as map's result would 
> define transient property if the wrapped range defines it.

Just to clarify, by "transient ranges would have to define 
transient property" I meant just that this should be true for 
transient ranges: is(typeof(R.transient)). So transient could 
just be an enum. I didn't mean there would be a transient 
property that would return a transient version of the range.


More information about the Digitalmars-d mailing list