summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMolly Lloyd <molly@mapbox.com>2018-08-22 10:57:02 -0700
committerMolly Lloyd <mollymerp@users.noreply.github.com>2018-08-31 13:08:47 -0700
commit2cdbe934c2df8e4efbadbda5d20eac0d59d24b05 (patch)
tree4e8c568dd43e92deee97066a14e776702320768d /include
parent4a5dc37245d23805d13865f5ef9c5f26e539a9ca (diff)
downloadqtlocation-mapboxgl-2cdbe934c2df8e4efbadbda5d20eac0d59d24b05.tar.gz
[windows, qt] fix windows compiler errors, remove tao + tuple polyfill
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/util/indexed_tuple.hpp19
-rw-r--r--include/mbgl/util/tuple.hpp19
2 files changed, 14 insertions, 24 deletions
diff --git a/include/mbgl/util/indexed_tuple.hpp b/include/mbgl/util/indexed_tuple.hpp
index d1a9e226b1..99d73d1e19 100644
--- a/include/mbgl/util/indexed_tuple.hpp
+++ b/include/mbgl/util/indexed_tuple.hpp
@@ -1,8 +1,8 @@
#pragma once
#include <mbgl/util/type_list.hpp>
-#include <mbgl/util/tuple.hpp>
+#include <tuple>
#include <type_traits>
namespace mbgl {
@@ -24,22 +24,22 @@ template <class...> class IndexedTuple;
// for motivation.
//
template <class... Is, class... Ts>
-class IndexedTuple<TypeList<Is...>, TypeList<Ts...>> : public tuple_polyfill<Ts...> {
+class IndexedTuple<TypeList<Is...>, TypeList<Ts...>> : public std::tuple<Ts...> {
public:
static_assert(sizeof...(Is) == sizeof...(Ts), "IndexedTuple size mismatch");
template <class I>
auto& get() {
- return get_polyfill<TypeIndex<I, Is...>::value>(*this);
+ return std::get<TypeIndex<I, Is...>::value, Ts...>(*this);
}
template <class I>
const auto& get() const {
- return get_polyfill<TypeIndex<I, Is...>::value>(*this);
+ return std::get<TypeIndex<I, Is...>::value, Ts...>(*this);
}
template <class... Us>
- IndexedTuple(Us&&... other) : tuple_polyfill<Ts...>(std::forward<Us>(other)...) {}
+ IndexedTuple(Us&&... other) : std::tuple<Ts...>(std::forward<Us>(other)...) {};
template <class... Js, class... Us>
IndexedTuple<TypeList<Is..., Js...>, TypeList<Ts..., Us...>>
@@ -49,6 +49,15 @@ public:
other.template get<Js>()...
};
}
+
+ // Help out MSVC++
+ bool operator==(const IndexedTuple<TypeList<Is...>, TypeList<Ts...>>& other) const {
+ return static_cast<const std::tuple<Ts...>&>(*this) == static_cast<const std::tuple<Ts...>&>(other);
+ }
+
+ bool operator!=(const IndexedTuple<TypeList<Is...>, TypeList<Ts...>>& other) const {
+ return !(*this == other);
+ }
};
template <class, class T>
diff --git a/include/mbgl/util/tuple.hpp b/include/mbgl/util/tuple.hpp
deleted file mode 100644
index 3f6e80a8c7..0000000000
--- a/include/mbgl/util/tuple.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#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