The std::packaged_task is a C++11 callable wrapper, similar to std::function, providing direct access to a std::future.
The std::packaged_task provides a more natural and simpler workflow than manually setting up and passing through a std::promise.
Click to open in Compiler Explorer.
Leave a comment
Question: why do you need to enclose that first assignment (auto c= ... ) in an extra set of curly braces?