groupTuple

Similarly to UniqTuple, creates a generic tuple comprised of packed generic tuples comprised of unique consecutive elemetns of A and counts of equivalent elements seen.

Equivalence of elements is assessed by using a binary predicate pred.

Members

Aliases

groupTuple
alias groupTuple = impl!(1, A)
Undocumented in source.
groupTuple
alias groupTuple = GenericTuple!()
Undocumented in source.
predTemplate
alias predTemplate = binaryPred!pred
Undocumented in source.

Templates

impl
template impl(size_t count, A...)
Undocumented in source.

Examples

alias tuple = GenericTuple!(1, 2, 2, 2, "x", "x", int, 1, 1);

alias group = groupTuple!(isSame, tuple);
static assert(group.length == 5);
static assert(group[0].equals!(1, 1));
static assert(group[1].equals!(2, 3));
static assert(group[2].equals!("x", 2));
static assert(group[3].equals!(int, 1));
static assert(group[4].equals!(1, 2));

alias group2 = groupTuple!(notTemplate!isSame, tuple);
static assert(group2.length == 3);
static assert(group2[0].equals!(1, 7));
static assert(group2[1].equals!(1, 1));
static assert(group2[2].equals!(1, 1));

Analog of $(STDREF algorithm, group) for generic tuples except pred must be explicitly specified.

Meta