The OpenD Programming Language

makePermutations

Lazily computes all permutations of r using Heap's algorithm.

While generating a new item is in O(k) (amortized O(1)), the number of permutations is |n|!.

makePermutations
(
T = uint
Allocator
)
(
auto ref Allocator alloc
,
size_t n
)
if (
T.sizeof <= size_t.sizeof
)

Parameters

n size_t

number of elements (|r|)

alloc Allocator

custom Allocator

Return Value

Type: Permutations!T

Forward range, which yields the permutations

See Also

Meta