diff options
Diffstat (limited to 'src/corelib/thread/qfuture.h')
-rw-r--r-- | src/corelib/thread/qfuture.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h index 5b618e5acb..3945df066a 100644 --- a/src/corelib/thread/qfuture.h +++ b/src/corelib/thread/qfuture.h @@ -55,7 +55,7 @@ public: return *this; } -#if defined(Q_CLANG_QDOC) +#if defined(Q_QDOC) ~QFuture() { } QFuture(const QFuture<T> &) { } QFuture<T> & operator=(const QFuture<T> &) { } @@ -155,7 +155,7 @@ QT_WARNING_POP template<class Function, typename = std::enable_if_t<std::is_invocable_r_v<T, Function>>> QFuture<T> onCanceled(QObject *context, Function &&handler); -#if !defined(Q_CLANG_QDOC) +#if !defined(Q_QDOC) template<class U = T, typename = std::enable_if_t<QtPrivate::isQFutureV<U>>> auto unwrap(); #else @@ -183,8 +183,6 @@ QT_WARNING_POP { future = o.future; index = o.index; return *this; } inline const T &operator*() const { return future->d.resultReference(index); } inline const T *operator->() const { return future->d.resultPointer(index); } - inline bool operator!=(const const_iterator &other) const { return index != other.index; } - inline bool operator==(const const_iterator &o) const { return !operator!=(o); } inline const_iterator &operator++() { index = advanceIndex(index, 1); return *this; } inline const_iterator &operator--() @@ -213,6 +211,12 @@ QT_WARNING_POP { return const_iterator(k.future, k.advanceIndex(k.index, j)); } private: + friend bool comparesEqual(const const_iterator &lhs, const const_iterator &rhs) noexcept + { + return lhs.index == rhs.index; + } + Q_DECLARE_EQUALITY_COMPARABLE(const_iterator) + /*! \internal Advances the iterator index \a idx \a n steps, waits for the @@ -445,7 +449,7 @@ struct MetaTypeQFutureHelper<QFuture<T>> namespace QtFuture { -#ifndef Q_CLANG_QDOC +#ifndef Q_QDOC template<typename OutputSequence, typename InputIt, typename ValueType = typename std::iterator_traits<InputIt>::value_type, @@ -520,7 +524,20 @@ QFuture<QtFuture::WhenAnyResult<T>> whenAny(InputIt first, InputIt last); template<typename... Futures> QFuture<std::variant<std::decay_t<Futures>...>> whenAny(Futures &&... futures); -#endif // Q_CLANG_QDOC +#endif // Q_QDOC + +#if QT_DEPRECATED_SINCE(6, 10) +#if defined(Q_QDOC) +static QFuture<void> makeReadyFuture() +#else +template<typename T = void> +QT_DEPRECATED_VERSION_X(6, 10, "Use makeReadyVoidFuture() instead.") +static QFuture<T> makeReadyFuture() +#endif +{ + return makeReadyVoidFuture(); +} +#endif // QT_DEPRECATED_SINCE(6, 10) } // namespace QtFuture |