|
KUMI v5.0.0
Gorgeous Garnet
|
| using kumi::function::cartesian_strides = decltype(kumi_implementation_defined) |
#include <kumi/functional/index_sequence.hpp>
A helper alias template computing the strides associated to the cartesian product operation.
For a cartesian product of M tuples of sizes N0, ..., N(M-1), the K-th element of the product selects, in the i-th input tuple, the element at index (K / S_i) % N_i. This alias computes the strides S_i, i.e. the number of consecutive product elements sharing the same index in tuple i. The last tuple varies fastest, so S_i is the product of the sizes of all tuples following tuple i and the last stride is always 1.
A std::index_sequence of M strides, one per input tuple, where S_i is the product of Sizes over positions strictly greater than i.
For Sizes = std::index_sequence<2, 3> and Elts = std::index_sequence<0, 1>, the result is std::index_sequence<3, 1>. The element K of the product then selects ((K / 3) % 2, (K / 1) % 3), which enumerates (0,0) (0,1) (0,2) (1,0) (1,1) (1,2).