summaryrefslogtreecommitdiff
path: root/include/mbgl/util/type_list.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/util/type_list.hpp')
-rw-r--r--include/mbgl/util/type_list.hpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/include/mbgl/util/type_list.hpp b/include/mbgl/util/type_list.hpp
index 4a5e95c8a4..1b594bf7f6 100644
--- a/include/mbgl/util/type_list.hpp
+++ b/include/mbgl/util/type_list.hpp
@@ -5,8 +5,11 @@
namespace mbgl {
-template <class...>
-class TypeList {};
+template <class... Ts>
+struct TypeList {
+ template <template <class...> class T, class... Ps>
+ using ExpandInto = T<Ps..., Ts...>;
+};
namespace detail {
@@ -32,9 +35,30 @@ struct TypeFilter<TypeList<T, Ts...>, Predicate> {
using Type = std::conditional_t<Predicate<T>::value, typename TypeCons<T, Tail>::Type, Tail>;
};
+template <class...>
+struct TypeListConcat;
+
+template <>
+struct TypeListConcat<> {
+ using Type = TypeList<>;
+};
+
+template <class... As>
+struct TypeListConcat<TypeList<As...>> {
+ using Type = TypeList<As...>;
+};
+
+template <class... As, class... Bs, class... Rs>
+struct TypeListConcat<TypeList<As...>, TypeList<Bs...>, Rs...> {
+ using Type = typename TypeListConcat<TypeList<As..., Bs...>, Rs...>::Type;
+};
+
} // namespace detail
template <class TypeList, template <class> class Predicate>
using FilteredTypeList = typename detail::TypeFilter<TypeList, Predicate>::Type;
+template <class... Ts>
+using TypeListConcat = typename detail::TypeListConcat<Ts...>::Type;
+
} // namespace mbgl