11 #ifndef EMP_TUPLE_UTILS_H 12 #define EMP_TUPLE_UTILS_H 17 #include "../meta/IntPack.h" 18 #include "../meta/meta.h" 23 template <
typename TUPLE_T>
24 constexpr
inline int tuple_size() {
return std::tuple_size<TUPLE_T>::value; }
28 template <
typename... Ts,
int... Ps>
30 return std::make_tuple( std::get<Ps>(tup)... );
36 template <
typename FUN_T,
typename TUPLE_T,
int... N >
38 return fun(std::get<N>(tup)...);
42 template <
typename FUN_T,
typename TUPLE_T>
43 auto ApplyTuple(
const FUN_T & fun,
const TUPLE_T & tup) {
50 template <
typename... TYPES>
53 using fun_t = std::function<std::size_t(TYPES...)>;
Setup tuples to be able to be used in hash tables.
Definition: tuple_utils.h:51
std::size_t CombineHash(const T &x)
Definition: meta.h:207
std::function< std::size_t(TYPES...)> fun_t
Definition: tuple_utils.h:53
std::tuple< TYPES... > tuple_t
Definition: tuple_utils.h:52
constexpr int tuple_size()
Quick way to calculate tuple size.
Definition: tuple_utils.h:24
typename internal::ip_range<(START >=END), START, END, STEP >::type IntPackRange
Definition: IntPack.h:117
auto ApplyTuple(const FUN_T &fun, const TUPLE_T &tup, IntPack< N... >)
Definition: tuple_utils.h:37
If we are in emscripten, make sure to include the header.
Definition: array.h:37
std::size_t operator()(const tuple_t &tup) const
Definition: tuple_utils.h:55
auto shuffle_tuple(const std::tuple< Ts... > &tup, IntPack< Ps... >)
Reorganize the entries in tuple; the provided int pack must specify the new ordering.
Definition: tuple_utils.h:29