The OpenD Programming Language

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).

makeCombinations
(
T = uint
Allocator
)
(
auto ref Allocator alloc
,
size_t n
,
size_t repeat
)
if (
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