The std::experimental::packaged_task
class template packages
a function or other callable object so that when the function is invoked
through the std::experimental::packaged_task
instance the result
is stored as an asynchronous result for retrieval through an instance of
std::experimental::future
.
Instances of std::experimental::packaged_task
are MoveConstructible
and MoveAssignable
,
but not CopyConstructible
or CopyAssignable
.
template<typename FunctionType> class packaged_task; // undefined template<typename ResultType,typename... ArgTypes> class packaged_task<ResultType(ArgTypes...)> { public: typedef ResultType result_type; packaged_task(); packaged_task(packaged_task&&); ~packaged_task(); packaged_task& operator=(packaged_task&&); template<typename Callable> explicit packaged_task(Callable func); template<typename R,typename... Args> explicit packaged_task(R (*func)(Args...)); template<typename Callable,typename Allocator> packaged_task( std::allocator_arg_t, const Allocator&, Callable); packaged_task(packaged_task const&) = delete; packaged_task& operator=( packaged_task const&) = delete; void swap(packaged_task&); explicit operator bool() const; std::experimental::future<ResultType> get_future(); void operator()(ArgTypes...); void reset(); };
#include <experimental/future>