cmpTuple

Performs three-way lexicographical comparison on two packed generic tuples according to predicate pred.

Iterating packedTuple1 and packedTuple2 in lockstep, cmpTuple compares each element A1 of packedTuple1 with the corresponding element A2 in packedTuple2. If Inst!(binaryPred!pred, A1, A2), cmp returns a negative value. If Inst!(binaryPred!pred, A2, A1), cmp returns a positive value. If one of the tuples has been finished, cmp returns a negative value if packedTuple1 has fewer elements than packedTuple2, a positive value if packedTuple1 has more elements than packedTuple2, and 0 if the tuples have the same number of elements.

  1. template cmpTuple(alias pred, alias packedTuple1, alias packedTuple2)
  2. eponymoustemplate cmpTuple(alias packedTuple1, alias packedTuple2)
    enum cmpTuple (
    alias packedTuple1
    alias packedTuple2
    )

Examples

static assert(cmpTuple!(packedExpressionTuple!0, packedExpressionTuple!0) == 0);
static assert(cmpTuple!(packedExpressionTuple!"a", packedExpressionTuple!"ab") < 0);
static assert(cmpTuple!(`T.sizeof < U.sizeof`, PackedTypeTuple!int, PackedTypeTuple!long) < 0);

Analog of $(STDREF algorithm, cmp) for generic tuples.

Meta