aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-12 14:58:46 +0200
committerLars Knoll <lars.knoll@qt.io>2018-10-15 06:52:38 +0000
commitf97e72d1da5961b5702f05653e42c9e853f75400 (patch)
tree0047505393e88b56fbe7062e5611bc6ba110f72d /src
parent41e15cb21c2f8924eee56aacc4ba8aace950cae5 (diff)
Fix compilation in C++11 mode
std::make_unique() doesn't exist in C++11, so add a polyfill. Task-number: QTBUG-71010 Change-Id: I6f1f32447be6fb7411c66fa2c986df5bf4346ee2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/masm/stubs/wtf/Optional.h11
-rw-r--r--src/3rdparty/masm/wtf/FilePrintStream.cpp1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/3rdparty/masm/stubs/wtf/Optional.h b/src/3rdparty/masm/stubs/wtf/Optional.h
index 44fa3ee62d..235730a87d 100644
--- a/src/3rdparty/masm/stubs/wtf/Optional.h
+++ b/src/3rdparty/masm/stubs/wtf/Optional.h
@@ -41,6 +41,7 @@
#include <QtCore/qglobal.h>
+#include <memory>
#if __cplusplus > 201402L && QT_HAS_INCLUDE(<optional>)
#include <optional>
#else
@@ -81,3 +82,13 @@ private:
}
#endif
+
+#if __cplusplus < 201402L && !defined(__cpp_lib_make_unique) && !defined(Q_CC_MSVC) && !defined(Q_CC_GHS)
+
+namespace std {
+ template<typename T, class ...Args>
+ unique_ptr<T> make_unique(Args &&...args)
+ { return unique_ptr<T>(new T(std::forward<Args>(args)...)); }
+}
+
+#endif
diff --git a/src/3rdparty/masm/wtf/FilePrintStream.cpp b/src/3rdparty/masm/wtf/FilePrintStream.cpp
index 28714ecb6f..a56b36526e 100644
--- a/src/3rdparty/masm/wtf/FilePrintStream.cpp
+++ b/src/3rdparty/masm/wtf/FilePrintStream.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "FilePrintStream.h"
+#include "Optional.h" // for make_unique polyfill if required
namespace WTF {