makeCartesianPower

Lazily computes the Cartesian power of r with itself for a number of repetitions D repeat. If the input is sorted, the product is in lexicographic order.

While generating a new item is in O(k) (amortized O(1)), the total number of elements is n^k.

  1. CartesianPower!T cartesianPower(size_t n, size_t repeat)
  2. IndexedRoR!(CartesianPower!T, Range) cartesianPower(Range r, size_t repeat)
  3. CartesianPower!T makeCartesianPower(Allocator alloc, size_t n, size_t repeat)
    makeCartesianPower
    (
    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|)

repeat size_t

number of repetitions

alloc Allocator

custom Allocator

Return Value

Type: CartesianPower!T

Forward range, which yields the product items

See Also

Meta