Construct a std::packaged_task object with an
associated task and asynchronous result.
template<typename FunctionResultType,typename FunctionArgs...> packaged_task(FunctionResultType (*func)(FunctionArgs...));
- Preconditions:
The expression
func(args...)shall be valid, where each elementargs-i inargs...shall be a value of the corresponding typeArgTypes-i inArgTypes.... The return value shall be convertible toResultType.- Effects:
Constructs a
std::packaged_taskinstance with an associated asynchronous result of typeResultTypethat is not ready and an associated task that is a copy offunc.- Throws:
An exception of type
std::bad_allocif the constructor is unable to allocate memory for the asynchronous result.
Header
#include <future>