Thread overview | |||||
---|---|---|---|---|---|
|
August 16, 2010 [phobos] Why isn't Joiner a forward range? | ||||
---|---|---|---|---|
| ||||
An HTML attachment was scrubbed... URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100816/059d5484/attachment.html> |
August 16, 2010 [phobos] Why isn't Joiner a forward range? | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | The reason is that joiner does not only consume its range argument, it eats every item of every item of the range argument (which must be a range of ranges). Therefore, it destructively chews through its input.
Andrei
David Simcha wrote:
> Why is std.algorithm.joiner explicitly *not* a forward range even when it can be? This is not an oversight. It appears to be an explicit decision. From the unittest:
>
> static assert(isInputRange!(typeof(joiner([""], ""))));
> static assert(!isForwardRange!(typeof(joiner([""], ""))));
>
> Maybe I'm missing something obvious, but I just can't think of any good reason for this decision.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
|
August 16, 2010 [phobos] Why isn't Joiner a forward range? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Monday 16 August 2010 21:42:51 Andrei Alexandrescu wrote:
> The reason is that joiner does not only consume its range argument, it eats every item of every item of the range argument (which must be a range of ranges). Therefore, it destructively chews through its input.
Yikes. I'd better keep it away from my computer cables... ;)
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation