A C++ template library for embedded applications
MIT licensed
Designed and
maintained by
John Wellbelove
Support the development
of the ETL

Combinations / Permutations
Templates to provide combinations and permutations constants.
____________________________________________________________________________________________________
Combinations

template <size_t N, size_t K>
struct combinations

Member const
static ETL_CONSTEXPR size_t value = Number of combinations of K items from a total of N

If C++17 is supported.
template <size_t N, size_t K>
inline constexpr size_t combinations_v = combinations<N, K>::value;

____________________________________________________________________________________________________
Permutations

template <size_t N, size_t K>
struct permutations

Member const
static ETL_CONSTEXPR size_t value = Number of permutations of K items from a total of N

If C++17 is supported.
template <size_t N, size_t K>
inline constexpr size_t permutations_v = permutations<N, K>::value;

combinations.h / permutations.h