[Issue 13936] groupBy must be redone

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jan 12 13:35:42 PST 2015


https://issues.dlang.org/show_bug.cgi?id=13936

--- Comment #32 from hsteoh at quickfur.ath.cx ---
(In reply to Andrei Alexandrescu from comment #31)
> (In reply to hsteoh from comment #28)
> > Another note: your current implementation looks like it could be easily
> > extended to handle non-equivalence predicates. All you need to do is to
> > evaluate the predicate on adjacent elements vs. with the head of the group
> > (IOW, just advance groupStart each time in Group.popFront). I doubt it would
> > cause too much performance hit.
> 
> That would popFront two ranges instead of one. I still very strongly suggest
> we define groupBy and groupByAdjancent.

No it won't. You just assign groupNext.save to groupCurrent, then call
groupNext.popFront.

--


More information about the Digitalmars-d-bugs mailing list