summaryrefslogtreecommitdiff
path: root/src/mbgl/util/indexed_tuple.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-10-28 16:39:50 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-02-02 09:44:42 -0800
commit141e995806576364d185626176c1b993fc519291 (patch)
treeecdc41fc7699f2a1a9e9456157348451ebe99597 /src/mbgl/util/indexed_tuple.hpp
parent6a6bddb4537004cc1bfc506e76772de74d33f3f7 (diff)
downloadqtlocation-mapboxgl-141e995806576364d185626176c1b993fc519291.tar.gz
[core] Add support for data-driven styling
Diffstat (limited to 'src/mbgl/util/indexed_tuple.hpp')
-rw-r--r--src/mbgl/util/indexed_tuple.hpp13
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