summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-01-24 09:25:38 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-01-24 09:37:54 +0000
commit1daaf613dc56c5ffedefe7ca6938ae5b191f9411 (patch)
tree6fdc48e49dca2766e71e01742ad104389e12be4f /src/corelib/thread
parent5fa35c4f14fc4bbd4ddcf747f1073bb65075256b (diff)
QFuture: add a missing include for qpromise.h
QPromise is now used in qfuture_impl.h, so we need to include it. Remove qfuture.h include from qpromise.h, to avoid circular dependency. As a drive-by, simplify a type-trait: is_convertible_v<T, S> is true whenever is_same_v<T, S> is, so we don't need to instantiate both. Fixes: QTBUG-100144 Pick-to: 6.3 6.2 Change-Id: Ic6df43d96d9d168cc44c2949e41c5e490f4c50ce Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qfuture_impl.h5
-rw-r--r--src/corelib/thread/qpromise.h9
2 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/thread/qfuture_impl.h b/src/corelib/thread/qfuture_impl.h
index b09d84a6d3..2924408333 100644
--- a/src/corelib/thread/qfuture_impl.h
+++ b/src/corelib/thread/qfuture_impl.h
@@ -51,6 +51,7 @@
#include <QtCore/qthreadpool.h>
#include <QtCore/qexception.h>
#include <QtCore/qpointer.h>
+#include <QtCore/qpromise.h>
QT_BEGIN_NAMESPACE
@@ -82,10 +83,6 @@ WhenAnyResult(qsizetype, const QFuture<T> &) -> WhenAnyResult<T>;
namespace QtPrivate {
-template<class T, class U>
-using EnableIfSameOrConvertible = std::enable_if_t<std::is_same_v<T, U>
- || std::is_convertible_v<T, U>>;
-
template<class T>
using EnableForVoid = std::enable_if_t<std::is_same_v<T, void>>;
diff --git a/src/corelib/thread/qpromise.h b/src/corelib/thread/qpromise.h
index f62a2a54e3..f7abf8babc 100644
--- a/src/corelib/thread/qpromise.h
+++ b/src/corelib/thread/qpromise.h
@@ -41,7 +41,7 @@
#define QPROMISE_H
#include <QtCore/qglobal.h>
-#include <QtCore/qfuture.h>
+#include <QtCore/qfutureinterface.h>
#include <utility>
@@ -49,6 +49,13 @@ QT_REQUIRE_CONFIG(future);
QT_BEGIN_NAMESPACE
+namespace QtPrivate {
+
+template<class T, class U>
+using EnableIfSameOrConvertible = std::enable_if_t<std::is_convertible_v<T, U>>;
+
+} // namespace QtPrivate
+
template<typename T>
class QPromise
{