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>
This commit is contained in:
Sona Kurazyan 2022-01-24 09:25:38 +01:00 committed by Marc Mutz
parent 5fa35c4f14
commit 1daaf613dc
2 changed files with 9 additions and 5 deletions

View File

@ -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>>;

View File

@ -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
{