From 5523597e7c62e6529af733b274a362b06a704070 Mon Sep 17 00:00:00 2001 From: Simon Brunel Date: Wed, 28 Feb 2018 09:37:29 +0100 Subject: [PATCH] - wip - - wip - --- src/qtpromise/qpromise.h | 9 ++ src/qtpromise/qpromise.inl | 28 ++++ src/qtpromise/qpromise_p.h | 78 ++++++++-- tests/auto/qtpromise/qpromise/cast/cast.pro | 4 + .../auto/qtpromise/qpromise/cast/tst_cast.cpp | 135 ++++++++++++++++++ tests/auto/qtpromise/qpromise/qpromise.pro | 1 + 6 files changed, 246 insertions(+), 9 deletions(-) create mode 100644 tests/auto/qtpromise/qpromise/cast/cast.pro create mode 100644 tests/auto/qtpromise/qpromise/cast/tst_cast.cpp diff --git a/src/qtpromise/qpromise.h b/src/qtpromise/qpromise.h index 47252f2..a69769a 100644 --- a/src/qtpromise/qpromise.h +++ b/src/qtpromise/qpromise.h @@ -23,6 +23,9 @@ public: template ::count != 1, int>::type = 0> inline QPromiseBase(F resolver); + template + inline QPromiseBase(const QPromise& other); + QPromiseBase(const QPromiseBase& other): m_d(other.m_d) {} QPromiseBase(const QPromise& other): m_d(other.m_d) {} QPromiseBase(QPromiseBase&& other) Q_DECL_NOEXCEPT { swap(other); } @@ -94,6 +97,9 @@ public: // STATIC inline static QPromise resolve(const T& value); inline static QPromise resolve(T&& value); + template + operator QPromise(); + private: friend class QPromiseBase; }; @@ -105,6 +111,9 @@ public: template QPromise(F&& resolver): QPromiseBase(std::forward(resolver)) { } + template + QPromise(const QPromise& other); + public: // STATIC template