dune-pdelab  2.4.1
typelist.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_PDELAB_COMMON_TYPELIST_HH
4 #define DUNE_PDELAB_COMMON_TYPELIST_HH
5 
6 #include <type_traits>
7 #include <tuple>
8 
9 
10 namespace Dune {
11 namespace PDELab {
12 
30  template<class... T>
31  struct TypeList
32  {};
33 
34 
35 
44  template<class T>
45  struct IsTypeList : std::false_type {};
46 
52  template<class... T>
53  struct IsTypeList<TypeList<T...> > : std::true_type {};
54 
55 
56 
65  template<class T>
66  struct IsEmptyTypeList : std::integral_constant<bool, IsTypeList<T>() and std::is_same<T, TypeList<> >() > {};
67 
68 
69 
70  template<class T>
71  struct TypeListSize {};
72 
81  template<class... T>
82  struct TypeListSize<TypeList<T...>> : std::integral_constant<std::size_t, sizeof...(T)> {};
83 
84 
85 
86  template<std::size_t i, class T>
87  struct TypeListElement {};
88 
94  template<std::size_t i, class... T>
95  struct TypeListElement<i, TypeList<T...>>
96  {
102  using type = typename std::tuple_element<i, std::tuple<T...>>::type;
103 
109  using Type = type;
110  };
111 
115  template<std::size_t i, class T>
117 
118 
119 } // namespace PDELab
120 } // namespace Dune
121 
122 #endif // DUNE_PDELAB_COMMON_TYPELIST_HH
type Type
Export type of i-th element in TypeList.
Definition: typelist.hh:109
Definition: adaptivity.hh:27
Check if given type is an empty TypeList.
Definition: typelist.hh:66
Definition: typelist.hh:87
Check if given type is a TypeList.
Definition: typelist.hh:45
typename std::tuple_element< i, std::tuple< T... >>::type type
Export type of i-th element in TypeList.
Definition: typelist.hh:102
A simple type list.
Definition: typelist.hh:31
typename TypeListElement< i, T >::type TypeListEntry_t
Shortcut for TypeListElement<i, T>::type;.
Definition: typelist.hh:116
Definition: typelist.hh:71