TaskTree: Add static assert ensuring the right Adapter type

Change-Id: I87e995151ec21963c5514dfdb1863cfd2bc457b9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Jarek Kobus
2023-08-01 09:42:56 +02:00
parent 925bb2ca31
commit e9721641fc

View File

@@ -318,6 +318,9 @@ class CustomTask : public GroupItem
{
public:
using Task = typename Adapter::Type;
static_assert(std::is_base_of_v<TaskAdapter<Task>, Adapter>,
"The Adapter type for the CustomTask<Adapter> needs to be derived from "
"TaskAdapter<Task>.");
using EndHandler = std::function<void(const Task &)>;
static Adapter *createAdapter() { return new Adapter; }
CustomTask() : GroupItem({&createAdapter}) {}