3#ifndef DUNE_COMMON_TYPELIST_HH
4#define DUNE_COMMON_TYPELIST_HH
124 struct TypeListSize {};
135 struct TypeListSize<
TypeList<T...>> : std::integral_constant<std::size_t, sizeof...(T)> {};
139 template<std::
size_t i,
class T>
140 struct TypeListElement {};
147 template<std::size_t i,
class... T>
155 using type =
typename std::tuple_element<i, std::tuple<T...>>::type;
168 template<std::
size_t i,
class T>
173 template<
template<
class...>
class Target,
class ToDoList,
class... Processed>
174 struct UniqueTypesHelper;
176 template<
template<
class...>
class Target,
class... Processed>
177 struct UniqueTypesHelper<Target,
TypeList<>, Processed...>
179 using type = Target<Processed...>;
182 template<
template<
class...>
class Target,
class T0,
class... T,
class... Processed>
183 struct UniqueTypesHelper<Target,
TypeList<T0, T...>, Processed...>
185 using type = std::conditional_t<
186 std::disjunction<std::is_same<T0, Processed>...>::value,
187 typename UniqueTypesHelper<Target,
TypeList<T...>, Processed...>::type,
188 typename UniqueTypesHelper<Target,
TypeList<T...>, T0, Processed...>::type>;
192 template<
template<
class...>
class Target,
class TL>
193 struct UnpackTypeList;
195 template<
template<
class...>
class Target,
class... T>
198 using type = Target<T...>;
207 template<
template<
class...>
class Target,
class TL>
217 template<
template<
class...>
class Target,
class... T>
225 template<
class NonUniqueTypeList>
226 using UniqueTypeList_t =
typename Impl::UniqueTypesHelper<TypeList, NonUniqueTypeList>::type;
std::tuple< MetaType< T >... > TypeList
A simple type list.
Definition: typelist.hh:85
Dune namespace.
Definition: alignedallocator.hh:11
typename Impl::UnpackTypeList< Target, TL >::type UnpackTypeList_t
Unpack Dune::TypeList.
Definition: typelist.hh:208
constexpr auto uniqueTypeList(TypeList< T... > list)
Remove duplicates from a Dune::TypeList.
Definition: typelist.hh:234
typename Impl::UniqueTypesHelper< Target, TypeList< T... > >::type UniqueTypes_t
Remove duplicates from a list of types.
Definition: typelist.hh:218
typename Impl::UniqueTypesHelper< TypeList, NonUniqueTypeList >::type UniqueTypeList_t
Remove duplicates from a Dune::TypeList.
Definition: typelist.hh:226
typename TypeListElement< i, T >::type TypeListEntry_t
Shortcut for TypeListElement<i, T>::type;.
Definition: typelist.hh:169
Check if given type is an empty TypeList.
Definition: typelist.hh:119
Check if given type is a TypeList.
Definition: typelist.hh:98
typename std::tuple_element< i, std::tuple< T... > >::type type
Export type of i-th element in TypeList.
Definition: typelist.hh:155
type Type
Export type of i-th element in TypeList.
Definition: typelist.hh:162