1#ifndef PODIO_UTILITIES_TYPEHELPERS_H
2#define PODIO_UTILITIES_TYPEHELPERS_H
8#include <unordered_map>
18 template <
typename T,
typename>
21 template <
typename T,
typename... Ts>
22 struct TypeInTupleHelper<T, std::tuple<Ts...>> : std::bool_constant<(std::is_same_v<T, Ts> || ...)> {};
28 template <
typename T,
typename Tuple>
43 template <
template <
typename...>
typename Template,
typename T>
46 template <
template <
typename...>
typename Template,
typename... Ts>
48 using type = std::tuple<Template<Ts>...>;
54 template <
typename Tuple>
62 template <
typename... Tuples>
63 using TupleCatType =
decltype(std::tuple_cat(std::declval<Tuples>()...));
69 template <
typename T,
typename Tuple>
70 static constexpr bool isAnyOrVectorOf = isInTuple<T, TupleCatType<Tuple, TupleOfVector<Tuple>>>;
102 template <
typename T>
108 template <
typename T>
111 template <
typename K,
typename V>
114 template <
typename K,
typename V>
121 template <
typename T>
130 template <
typename T,
typename IsMap = std::
bool_constant<isMap<T>>,
131 typename IsVector = std::
bool_constant<isVector<T> && (std::tuple_size<
typename T::value_type>() == 2)>>
137 template <
typename T>
146 template <
typename T>
148 using key_type =
typename std::tuple_element<0, typename T::value_type>::type;
149 using mapped_type =
typename std::tuple_element<1, typename T::value_type>::type;
155 template <
typename T>
158 template <
typename T>
170static constexpr bool isCollection = std::is_base_of_v<CollectionBase, T>;
typename ToTupleOfTemplateHelper< std::vector, Tuple >::type TupleOfVector
typename MapLikeTypeHelper< T >::mapped_type GetMappedType
decltype(std::tuple_cat(std::declval< Tuples >()...)) TupleCatType
typename MapLikeTypeHelper< T >::key_type GetKeyType
typename GetVectorTypeHelper< T >::type GetVectorType
typename std::tuple_element< 1, typename T::value_type >::type mapped_type
typename std::tuple_element< 0, typename T::value_type >::type key_type
typename T::mapped_type mapped_type
typename T::key_type key_type
std::tuple< Template< Ts >... > type