Fix crappy template

This commit is contained in:
Robin Dietzel 2023-12-07 21:39:28 +01:00
parent b39bbeb8dc
commit a335828778

View File

@ -69,11 +69,12 @@ public:
};
template<typename T, typename ...Argts>
template<typename T>
class Worker : public QThread {
private:
std::unique_ptr<IPrintable> printer_;
public:
template<typename ...Argts>
Worker(QString tname, Argts &... args) : printer_(std::make_unique<T>(args...)) {};
protected:
@ -93,9 +94,9 @@ int main(int argc, char *argv[]) {
QSemaphore lockC(1);
QSemaphore lockBC(0);
Worker<PrintA, QSemaphore> t1("Thread 1", lockBC);
Worker<PrintB, QSemaphore, QSemaphore> t2("Thread 1", lockBC, lockC);
Worker<PrintC, QSemaphore, QSemaphore> t3("Thread 1", lockBC, lockC);
Worker<PrintA> t1("Thread 1", lockBC);
Worker<PrintB> t2("Thread 1", lockBC, lockC);
Worker<PrintC> t3("Thread 1", lockBC, lockC);
t1.start();
t2.start();