std::packaged_task

From Cppreference

Jump to: navigation, search
Defined in header <future>

template< class > class packaged_task; //not defined
(1) (C++11 feature)
template< class Function, class Args... >
class packaged_task<Function(Args...)>;
(2) (C++11 feature)

The class template std::packaged_task packages a function to store its return value that is later acquired asynchronously via a std::future object, that the std::packaged_task can supply.


Contents

[edit] Member functions

(constructor)
constructs the task object
(public member function)
(destructor)
destructs the task object
(public member function)
operator=
moves the task object
(public member function)
valid
checks if the task object has a valid function
(public member function)
swap
swaps two task objects
(public member function)
Getting the result
get_future
returns a future associated with the promised result
(public member function)
Execution
operator()
executes the function
(public member function)
make_ready_at_thread_exit
executes the function ensuring that the result is ready
only once the current thread exits
(public member function)
reset
resets the state abandoning any stored results of previous executions
(public member function)

[edit] Non-member functions