First time,I read this code,I have mistaken task is packaged_task at this line auto task = std::make_shared< std::packaged_task<return_type()> >(std::bind(std::forward(f), std::forward(args)...));.
And I worry about whether this line task = std::move(this->tasks.front()); exception safe.At here task is a callable type.I spend many time on reading this line ,tasks.emplace([task](){ (*task)(); }); then I found at here task is shared_ptr.
First time,I read this code,I have mistaken task is packaged_task at this line auto task = std::make_shared< std::packaged_task<return_type()> >(std::bind(std::forward(f), std::forward(args)...));.
And I worry about whether this line task = std::move(this->tasks.front()); exception safe.At here task is a callable type.I spend many time on reading this line ,tasks.emplace([task](){ (*task)(); }); then I found at here task is shared_ptr.
This is a suggestion. Thanks everyone.