46template <
typename RetT>
56 template <
typename... Args>
58 :
VTask{
std::forward<Args>(args)... }
73 virtual RetT
get() = 0;
79template <typename RetT, typename... Args>
92 template <
typename FuncT>
95 , m_ptask{ std::move(func) }
99 template <
typename FuncT>
100 PackagedTask(
bool _is_native, intmax_t _depth, FuncT func, Args... args)
102 , m_ptask{ std::move(func) }
116 void operator()() final { mpl::apply(std::move(m_ptask), std::move(m_args)); }
118 void wait() final {
return m_ptask.get_future().wait(); }
119 RetT
get() final {
return m_ptask.get_future().get(); }
122 packaged_task_type m_ptask;
129template <
typename RetT,
typename... Args>
141 template <
typename FuncT>
144 , m_ptask{ std::move(func) }
148 template <
typename FuncT>
149 Task(
bool _is_native, intmax_t _depth, FuncT func, Args... args)
151 , m_ptask{ std::move(func) }
165 void operator()() final
168 mpl::apply(std::move(m_ptask), std::move(m_args));
171 void wait() final {
return m_ptask.get_future().wait(); }
172 RetT
get() final {
return m_ptask.get_future().get(); }
175 packaged_task_type m_ptask{};
182template <
typename RetT>
193 template <
typename FuncT>
196 , m_ptask{
std::move(func) }
199 template <
typename FuncT>
200 Task(
bool _is_native, intmax_t _depth, FuncT func)
202 , m_ptask{ std::move(func) }
215 virtual
void operator()() final { m_ptask(); }
217 virtual void wait() final {
return m_ptask.get_future().wait(); }
218 virtual RetT
get() final {
return m_ptask.get_future().get(); }
221 packaged_task_type m_ptask{};
239 template <
typename FuncT>
242 , m_ptask{ std::move(func) }
245 template <
typename FuncT>
246 Task(
bool _is_native, intmax_t _depth, FuncT func)
248 , m_ptask{ std::move(func) }
263 void wait() final {
return m_ptask.get_future().wait(); }
264 RetT get() final {
return m_ptask.get_future().get(); }
267 packaged_task_type m_ptask{};
The task class is supplied to thread_pool.
PackagedTask(const PackagedTask &)=delete
std::future< RetT > future_type
std::tuple< Args... > tuple_type
PackagedTask(bool _is_native, intmax_t _depth, FuncT func, Args... args)
future_type get_future() final
PackagedTask(FuncT func, Args... args)
PackagedTask & operator=(const PackagedTask &)=delete
std::packaged_task< RetT(Args...)> packaged_task_type
PackagedTask(PackagedTask &&) noexcept=default
std::promise< RetT > promise_type
~PackagedTask() override=default
The task class is supplied to thread_pool.
std::promise< RetT > promise_type
TaskFuture(const TaskFuture &)=delete
TaskFuture & operator=(const TaskFuture &)=delete
std::future< RetT > future_type
~TaskFuture() override=default
TaskFuture(Args &&... args)
TaskFuture(TaskFuture &&) noexcept=default
virtual future_type get_future()=0
std::future< RetT > future_type
Task & operator=(const Task &)=delete
Task(bool _is_native, intmax_t _depth, FuncT func)
Task(const Task &)=delete
std::promise< RetT > promise_type
std::packaged_task< RetT()> packaged_task_type
virtual future_type get_future() final
Task(Task &&) noexcept=default
virtual void wait() final
The task class is supplied to thread_pool.
Task & operator=(Task &&)=default
Task & operator=(const Task &)=delete
std::packaged_task< RetT()> packaged_task_type
future_type get_future() final
Task(bool _is_native, intmax_t _depth, FuncT func)
std::promise< RetT > promise_type
std::future< RetT > future_type
Task(const Task &)=delete
The task class is supplied to thread_pool.
std::future< RetT > future_type
Task & operator=(const Task &)=delete
Task(FuncT func, Args... args)
future_type get_future() final
std::promise< RetT > promise_type
std::tuple< Args... > tuple_type
Task(bool _is_native, intmax_t _depth, FuncT func, Args... args)
Task(const Task &)=delete
std::packaged_task< RetT(Args...)> packaged_task_type
Task(Task &&) noexcept=default
VTask is the abstract class stored in thread_pool.