diff options
Diffstat (limited to 'src/mbgl/util/indexed_tuple.hpp')
-rw-r--r-- | src/mbgl/util/indexed_tuple.hpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mbgl/util/indexed_tuple.hpp b/src/mbgl/util/indexed_tuple.hpp index 110e7dce12..a414639530 100644 --- a/src/mbgl/util/indexed_tuple.hpp +++ b/src/mbgl/util/indexed_tuple.hpp @@ -1,5 +1,7 @@ #pragma once +#include <mbgl/util/type_list.hpp> + #include <type_traits> #include <tuple> @@ -14,8 +16,6 @@ struct TypeIndex<T, T, Ts...> : std::integral_constant<std::size_t, 0> {}; template <class T, class U, class... Ts> struct TypeIndex<T, U, Ts...> : std::integral_constant<std::size_t, 1 + TypeIndex<T, Ts...>::value> {}; -template <class...> class TypeList {}; - template <class...> class IndexedTuple; // A tuple of Ts, where individual members can be accessed via `t.get<I>()` for I ∈ Is. @@ -42,6 +42,15 @@ public: const auto& get() const { return std::get<Index<I>>(*this); } + + template <class... Js, class... Us> + IndexedTuple<TypeList<Is..., Js...>, TypeList<Ts..., Us...>> + concat(const IndexedTuple<TypeList<Js...>, TypeList<Us...>>& other) const { + return IndexedTuple<TypeList<Is..., Js...>, TypeList<Ts..., Us...>> { + get<Is>()..., + other.template get<Js>()... + }; + } }; } // namespace mbgl |