[Issue 13595] Extend std.algorithm.groupBy to support non-equivalence relations

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Nov 4 15:18:34 PST 2014


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

--- Comment #5 from bearophile_hugs at eml.cc ---
(In reply to hsteoh from comment #4)
> P.S. Due to the extra performance overhead in evaluating the predicate for
> every adjacent pair of elements (and also additional logic to ensure
> correctness), groupBy now takes a compile-time parameter that can be used to
> get the original performance when the predicate is an equivalence relation.
> This way we have the best of both worlds. :-)

Thank you. But there's a risk of "Boolean Blindness"
(http://existentialtype.wordpress.com/2011/03/15/boolean-blindness/ ), so
perhaps it's better to use std.typecons.Flag instead of a bool.

Regarding groupBy, I hope someday we'll also have a hashGroupBy or something
similar (Issue 9842 ).

--


More information about the Digitalmars-d-bugs mailing list