Phobos git HEAD has a new range adaptor called groupBy that does what
you want:

        assert([1,1,2,2,2,3,4,4].groupBy!((a)=>a).equal(
                [[1,1], [2,2,2], [3], [4,4]]
        ))


T

Thanks! I wonder if this works with all input ranges. As I see
it, every implementation will have to iterate the original range
twice (if fully consumed). One iteration by the subranges and one
to move subrange range forward. It only skimmed the code, but I'd thought that would at least require forward ranges or a buffer.

Reply via email to