From d00e56ada0da13d9f9c99b614f915a8ac81236ca Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Thu, 4 Jan 2018 18:53:45 +0200 Subject: [windows][core] Add std::tuple replacement for Windows Windows STL + Clang can't build our IndexedTuple class. --- include/mbgl/util/indexed_tuple.hpp | 10 +++++----- include/mbgl/util/tuple.hpp | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 include/mbgl/util/tuple.hpp 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 +#include #include -#include namespace mbgl { @@ -24,20 +24,20 @@ template class IndexedTuple; // for motivation. // template -class IndexedTuple, TypeList> : public std::tuple { +class IndexedTuple, TypeList> : public tuple_polyfill { public: static_assert(sizeof...(Is) == sizeof...(Ts), "IndexedTuple size mismatch"); - using std::tuple::tuple; + using tuple_polyfill::tuple; template auto& get() { - return std::get::value>(*this); + return get_polyfill::value>(*this); } template const auto& get() const { - return std::get::value>(*this); + return get_polyfill::value>(*this); } template 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 + +#define get_polyfill tao::get +#define tuple_polyfill tao::tuple + +#else + +#include + +#define get_polyfill std::get +#define tuple_polyfill std::tuple + +#endif -- cgit v1.2.1