AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::inlet::detail::permutation_helper< N > Struct Template Reference

Recursive helper struct for enumerating permutations of a list of types. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.5.0/src/axom/inlet/Function.hpp>

Static Public Member Functions

template<typename... Ts, typename... Us>
static auto get (TypeList< Ts... > t, TypeList< Us... > u) -> decltype(permutation_helper< N - 1 >::get(t, type_list_cat(typename multi_list_prepend< Ts, Us... >::type()...)))
 

Detailed Description

template<std::size_t N>
struct axom::inlet::detail::permutation_helper< N >

Recursive helper struct for enumerating permutations of a list of types.

Template Parameters
NThe zero-indexed length of the permutations to produce ("stack height")
Ts...The original (1-dimensional) set of types to permute, e.g. <A, B, C>
Us...The current "result" list of lists, each member U in Us will be a list whose size is the original requested permutation length minus the current stack height N
Note
This function works by modifying the "result" type. The multi_list_prepend is called to add each original type T to each U in Us. The resulting list of lists from the concatenation of each T is then concatenated with type_list_cat. For example, with Ts = <A, B, C> and Us = TypeList<TypeList, TypeList, TypeList<C>>, the full type_list_cat call is type_list_cat(TypeList<TypeList<A, A>, TypeList<A, B>, TypeList<A, C>>, TypeList<TypeList<B, A>, TypeList<B, B>, TypeList<B, C>>, ...)

The Us pack is expanded in the multi_list_prepend "call" whereas the Ts pack is expanded as part of the type_list_cat "call"

The Python-like pseudocode for this function is roughly:

def permutation_helper(Ts, Us, N):
if N == 0:
return Us
else:
result = []
for T in Ts:
result.append(permute(Ts, [T + U for U in Us], N - 1))
return result

Member Function Documentation

◆ get()

template<std::size_t N>
template<typename... Ts, typename... Us>
static auto axom::inlet::detail::permutation_helper< N >::get ( TypeList< Ts... >  t,
TypeList< Us... >  u 
) -> decltype(permutation_helper< N - 1 >::get(t, type_list_cat(typename multi_list_prepend< Ts, Us... >::type()...)))
static

The documentation for this struct was generated from the following file: