summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfuture_impl.h
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-03-18 21:41:58 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2020-03-23 16:47:47 +0100
commit1005c86c6101a9cdc5ce37de3fd5bc67505bf8bc (patch)
treeed9fdd027c5401147e5a5360d12d755e18093233 /src/corelib/thread/qfuture_impl.h
parent20eabb72de94ddcef3c36b5cad0ce88944d42f8c (diff)
Clean-up the duplicate code in QFuture and QFutureWatcher
QFuture<void> and QFutureWatcher<void> are specialized to not contain any of result fetching methods, but otherwise they share almost the same implementation with QFuture<T> and QFutureWatcher<T> respectively. This change unifies their implementations to get rid of unnecessary code duplication. Change-Id: I9494ddc58c6db192c66edb988105927da6d61a3b Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Diffstat (limited to 'src/corelib/thread/qfuture_impl.h')
-rw-r--r--src/corelib/thread/qfuture_impl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/thread/qfuture_impl.h b/src/corelib/thread/qfuture_impl.h
index eed7828c35..20ee7e4f33 100644
--- a/src/corelib/thread/qfuture_impl.h
+++ b/src/corelib/thread/qfuture_impl.h
@@ -66,6 +66,12 @@ enum class Launch { Sync, Async, Inherit };
namespace QtPrivate {
+template<class T>
+using EnableForVoid = std::enable_if_t<std::is_same_v<T, void>>;
+
+template<class T>
+using EnableForNonVoid = std::enable_if_t<!std::is_same_v<T, void>>;
+
template<typename F, typename Arg, typename Enable = void>
struct ResultTypeHelper
{