25template <
typename List1,
typename List2>
28template <
template <
typename... >
typename List,
typename... Types1,
36template <
typename List1,
typename List2>
48template <
typename Pred,
template <
typename...>
typename SomeListOfTypes>
54template <
typename Pred,
template <
typename...>
typename SomeListOfTypes,
55 typename Head,
typename... Tail>
56constexpr decltype(
auto)
filter(Pred pred, SomeListOfTypes<Head, Tail...>*)
58 constexpr auto tail_arg =
static_cast<List<Tail...
>*>(
nullptr);
59 using TailFiltered =
decltype(
filter(pred, tail_arg));
62 std::conditional_t<pred((Head*)
nullptr),
77template <
typename List,
typename Pred>
88template <
template <
typename >
typename MapFromTypeToType,
92template <
template <
typename >
typename MapFromTypeToType,
93 template <
typename... >
typename List,
typename... Types>
94struct Map<MapFromTypeToType,
List<Types...>>
100template <
template <
typename >
typename MapFromTypeToType,
107template <
template <
typename... >
typename List,
typename Function,
108 typename Head,
typename... Tail>
112 std::common_type_t<std::invoke_result_t<Function, Head*>,
113 std::invoke_result_t<Function, Tail*>...>;
115 return std::array<CommonType, 1 +
sizeof...(Tail)>{f((Head*)
nullptr),
116 f((Tail*)
nullptr)...};
119template <
template <
typename... >
typename List,
typename Function>
133template <
typename List,
typename Function>
142template <
template <
typename... >
typename List,
typename Function,
146 (..., f((Types*)
nullptr));
156template <
typename List,
typename Function>
157void foreach (Function&& f)
164template <
typename List,
typename Type>
167 auto pred_is_same = []<
typename OtherType>(OtherType*)
168 {
return std::is_same_v<Type, OtherType>; };
170 return any_of(map_to_array<List>(pred_is_same));
constexpr decltype(auto) map_to_array(Function &&f, List< Head, Tail... > *)
void foreach(Function &&f, List< Types... > *)
constexpr List filter(Pred, SomeListOfTypes<> *)
constexpr decltype(auto) map_to_array(Function &&f)
typename Concat< List1, List2 >::type Concat_t
constexpr bool contains()
Returns if Type is contained in the given List of types.
decltype(auto) filter(Pred pred)
typename Map< MapFromTypeToType, List >::type Map_t
constexpr bool any_of(List const &values)
Checks if any of the elements in the given list is true.