summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2018-01-04 18:53:45 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2018-01-08 22:58:20 +0200
commitd00e56ada0da13d9f9c99b614f915a8ac81236ca (patch)
tree63d51a4c1602a707e509b8f40245c5e92a5c8064 /include/mbgl/util
parent5786286f9cb173eaf65dd677e3fadfb181ba3825 (diff)
downloadqtlocation-mapboxgl-d00e56ada0da13d9f9c99b614f915a8ac81236ca.tar.gz
[windows][core] Add std::tuple replacement for Windows
Windows STL + Clang can't build our IndexedTuple class.
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/indexed_tuple.hpp10
-rw-r--r--include/mbgl/util/tuple.hpp19
2 files changed, 24 insertions, 5 deletions
diff --git a/include/mbgl/util/indexed_tuple.hpp b/include/mbgl/util/indexed_tuple.hpp
index fd0b931d36..ea4fe74624 100644
--- a/include/mbgl/util/indexed_tuple.hpp
+++ b/include/mbgl/util/indexed_tuple.hpp
@@ -1,9 +1,9 @@
#pragma once
#include <mbgl/util/type_list.hpp>
+#include <mbgl/util/tuple.hpp>
#include <type_traits>
-#include <tuple>
namespace mbgl {
@@ -24,20 +24,20 @@ template <class...> class IndexedTuple;
// for motivation.
//
template <class... Is, class... Ts>
-class IndexedTuple<TypeList<Is...>, TypeList<Ts...>> : public std::tuple<Ts...> {
+class IndexedTuple<TypeList<Is...>, TypeList<Ts...>> : public tuple_polyfill<Ts...> {
public:
static_assert(sizeof...(Is) == sizeof...(Ts), "IndexedTuple size mismatch");
- using std::tuple<Ts...>::tuple;
+ using tuple_polyfill<Ts...>::tuple;
template <class I>
auto& get() {
- return std::get<TypeIndex<I, Is...>::value>(*this);
+ return get_polyfill<TypeIndex<I, Is...>::value>(*this);
}
template <class I>
const auto& get() const {
- return std::get<TypeIndex<I, Is...>::value>(*this);
+ return get_polyfill<TypeIndex<I, Is...>::value>(*this);
}
template <class... Js, class... Us>
diff --git a/include/mbgl/util/tuple.hpp b/include/mbgl/util/tuple.hpp
new file mode 100644
index 0000000000..3f6e80a8c7
--- /dev/null
+++ b/include/mbgl/util/tuple.hpp
@@ -0,0 +1,19 @@
+#pragma once
+
+// Polyfill needed by Windows because MSVC STL
+// is not compatible with our IndexedTuple code
+#if defined(_WINDOWS)
+
+#include <tao/tuple/tuple.hpp>
+
+#define get_polyfill tao::get
+#define tuple_polyfill tao::tuple
+
+#else
+
+#include <tuple>
+
+#define get_polyfill std::get
+#define tuple_polyfill std::tuple
+
+#endif