groupBy

Undocumented in source. Be warned that the author may not have intended to support it.
groupBy
(
alias func = function
(
a
)
R
)
()
if (
isInputRange!R
)

Examples

import std.stdio : writeln;
import std.algorithm : sort;
import std.typecons : tuple;
auto xs = [
    tuple("a", 1.0),
    tuple("b", 3.0),
    tuple("a", 2.0),
    tuple("b", 4.0)];
auto grouped = xs.groupBy!((a) => a[0]);
assertEqual( grouped.keys.length, 2 );
assertEqual( grouped.keys.sort(), ["a","b"].sort() );

Meta