aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2019-05-07 00:05:08 +0300
committerOrgad Shaneh <orgads@gmail.com>2019-05-24 12:16:38 +0000
commitc4071d09adf41d4931944e8dc122ab4c6613c779 (patch)
treed64dfaf83e7828788a3330b0205568f93c438f8a
parent2439cfcbdb6ade63bc37c1a5aecc4d91aa1995f3 (diff)
Variant: Prepare for C++17 support
Change-Id: I8f96ce3afae050d4e58e7fe9b70a92155045b71b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r--src/libs/utils/variant.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/libs/utils/variant.h b/src/libs/utils/variant.h
index 00e9eaf252..371b9312d3 100644
--- a/src/libs/utils/variant.h
+++ b/src/libs/utils/variant.h
@@ -30,10 +30,25 @@
*/
// TODO: replace by #include <(experimental/)variant> depending on compiler and C++ version
-#include <3rdparty/variant/variant.hpp>
+#if __cplusplus >= 201703L
+#error Please delete variant.hpp and the #else section below, then remove this error
+#include <variant>
namespace Utils {
+using std::get;
+using std::get_if;
+using std::holds_alternative;
+using std::variant;
+} // namespace Utils
-using namespace mpark;
+#else
+#include <3rdparty/variant/variant.hpp>
+namespace Utils {
+using mpark::get;
+using mpark::get_if;
+using mpark::holds_alternative;
+using mpark::variant;
} // namespace Utils
+
+#endif