| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QTCONCURRENTTASK_H |
| 5 | #define QTCONCURRENTTASK_H |
| 6 | |
| 7 | #if !defined(QT_NO_CONCURRENT) |
| 8 | |
| 9 | #include <QtConcurrent/qtaskbuilder.h> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | #ifdef Q_QDOC |
| 14 | |
| 15 | namespace QtConcurrent { |
| 16 | |
| 17 | template <class Task> |
| 18 | [[nodiscard]] |
| 19 | QTaskBuilder<Task> task(Task &&task); |
| 20 | |
| 21 | } // namespace QtConcurrent |
| 22 | |
| 23 | #else |
| 24 | |
| 25 | namespace QtConcurrent { |
| 26 | |
| 27 | template <class Task> |
| 28 | [[nodiscard]] |
| 29 | constexpr auto task(Task &&t) { return QTaskBuilder(std::forward<Task>(t)); } |
| 30 | |
| 31 | } // namespace QtConcurrent |
| 32 | |
| 33 | #endif // Q_QDOC |
| 34 | |
| 35 | QT_END_NAMESPACE |
| 36 | |
| 37 | #endif // !defined(QT_NO_CONCURRENT) |
| 38 | |
| 39 | #endif // QTCONCURRENTTASK_H |
| 40 | |