#pragma once #include class Task { public: Task(){}; template Task(Func f, Args&& ...args) { func = std::bind(f, std::forward(args)...); } virtual void run() { func(); } void setPriority(int priority) { m_priority = priority; } friend bool operator<(const Task& t1, const Task& t2); private: std::function func; int m_priority = 100; }; inline bool operator<(const Task& t1, const Task& t2) { return t1.m_priority < t2.m_priority; }