makeCombinations

Lazily computes all k-combinations of r. Imagine this as the cartesianPower filtered for only strictly ordered items.

While generating a new combination is in O(k), the number of combinations is binomial(n, k).

  1. Combinations!T combinations(size_t n, size_t k)
  2. IndexedRoR!(Combinations!T, Range) combinations(Range r, size_t k)
  3. Combinations!T makeCombinations(Allocator alloc, size_t n, size_t repeat)
    makeCombinations
    (
    T = uint
    Allocator
    )
    (
    auto ref Allocator alloc
    ,
    size_t n
    ,
    size_t repeat
    )
    if (
    isUnsigned!T &&
    T.sizeof <= size_t.sizeof
    )

Parameters

n size_t

number of elements (|r|)

alloc Allocator

custom Allocator

Return Value

Type: Combinations!T

Forward range, which yields the k-combinations items

See Also

Meta