summaryrefslogtreecommitdiff
path: root/lib/worker.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/worker.h')
-rw-r--r--lib/worker.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/worker.h b/lib/worker.h
index 04e351b..7df16cd 100644
--- a/lib/worker.h
+++ b/lib/worker.h
@@ -2,6 +2,7 @@
#define WORKER_H
#include <utility>
+class Work;
#if __cpp_lib_semaphore
# include <deque>
@@ -12,8 +13,6 @@
# include <thread>
# include <vector>
-class Work;
-
class Worker {
public:
Worker();
@@ -26,7 +25,7 @@ public:
template<typename T, typename... Params>
void
- addWork(Params &&... params)
+ addWork(Params &&... params) requires std::is_base_of_v<Work, T>
{
addWork(std::make_unique<T>(std::forward<Params>(params)...));
}
@@ -51,7 +50,7 @@ class Worker {
public:
template<typename T, typename... Params>
void
- addWork(Params &&... params)
+ addWork(Params &&... params) requires std::is_base_of_v<Work, T>
{
T(std::forward<Params>(params)...).doWork();
}