[phobos] Why isn't Joiner a forward range?

Andrei Alexandrescu andrei at erdani.com
Mon Aug 16 21:42:51 PDT 2010

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.


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

More information about the phobos mailing list