I'm back

jerro a at a.com
Fri Nov 23 13:13:17 PST 2012


> It's not worth the extra complication. Every algorithm ever 
> written then has
> to worry about it (though clearly many outside of Phobos 
> wouldn't bother), and
> it's yet another thing that anyone writing a range-based 
> function has to take
> into account. Any function which doesn't take it into account 
> will then end up
> with wrong and bizarre behavior when it's given a range with a 
> transient
> front.

My proposal was that for example isInputRange!R wouldn't compile 
if R was transient. So as long as people used the existing 
is***Range templates, the code that called an algorithm that only 
works with non-transient ranges with a transient range wouldn't 
compile. The functions that do support transient ranges could 
check for isInputRange!(R, true) instead of checking for 
isInputRange!R.

> To be correct, most range-based functions would have to add 
> template
> constraints to block ranges which mark themselves as transient.

If they already use is***Range constraints, they wouldn't have to 
add anything.


More information about the Digitalmars-d mailing list