forked from qt-creator/qt-creator
TaskTree: Add static asserts to onStorage{Setup,Done} handlers
Require const reference for onStorageDone() handler. Change-Id: Iad333c04a78962a3361635900027bd4d41abc319 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -413,11 +413,21 @@ public:
|
||||
|
||||
template <typename StorageStruct, typename StorageHandler>
|
||||
void onStorageSetup(const TreeStorage<StorageStruct> &storage, StorageHandler &&handler) {
|
||||
constexpr bool isInvokable = std::is_invocable_v<std::decay_t<StorageHandler>,
|
||||
StorageStruct &>;
|
||||
static_assert(isInvokable,
|
||||
"Storage setup handler needs to take (Storage &) as an argument. "
|
||||
"The passed handler doesn't fulfill these requirements.");
|
||||
setupStorageHandler(storage,
|
||||
wrapHandler<StorageStruct>(std::forward<StorageHandler>(handler)), {});
|
||||
}
|
||||
template <typename StorageStruct, typename StorageHandler>
|
||||
void onStorageDone(const TreeStorage<StorageStruct> &storage, StorageHandler &&handler) {
|
||||
constexpr bool isInvokable = std::is_invocable_v<std::decay_t<StorageHandler>,
|
||||
const StorageStruct &>;
|
||||
static_assert(isInvokable,
|
||||
"Storage done handler needs to take (const Storage &) as an argument. "
|
||||
"The passed handler doesn't fulfill these requirements.");
|
||||
setupStorageHandler(storage,
|
||||
{}, wrapHandler<StorageStruct>(std::forward<StorageHandler>(handler)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user