SysTutorials

Linux Manual Pages › Section 3

stdexperimentalpackaged_tasklibraryfundamentalsts(3)

std::experimental::packaged_task(libraryfundamentalsTS) - std::experimental::packaged_task(libraryfundamentalsTS)

Synopsis

Defined in header <experimental/future>
template< class > class packaged_task; //not defined (1) (library fundamentals TS)
template< class R, class ...Args >                   (2) (library fundamentals TS)
class packaged_task<R(Args...)>;

std::experimental::fundamentals_v1::packaged_task (and std::experimental::fundamentals_v2::packaged_task) is a modified version of std::packaged_task provided by the library fundamentals TS with support for type-erased allocators.

Member types

Member type Definition allocator_type std::experimental::erased_type

Member functions

                    constructs the task object constructor (public member function)                     retrieves a pointer to the memory resource used by this object to allocate memory get_memory_resource (public member function)

Non-member function

                                                          specializes the swap algorithm std::experimental::swap(std::experimental::packaged_task) (function template)

Helper classes

                                                      specializes the std::uses_allocator type trait std::uses_allocator<std::experimental::packaged_task> (class template specialization)

Members identical to std::packaged_task

Member functions

                          destructs the task object destructor (public member function of std::packaged_task<R(Args…)>)                           moves the task object operator= (public member function of std::packaged_task<R(Args…)>)                           checks if the task object has a valid function valid (public member function of std::packaged_task<R(Args…)>)                           swaps two task objects swap (public member function of std::packaged_task<R(Args…)>)

Getting the result

                          returns a std::future associated with the promised result get_future (public member function of std::packaged_task<R(Args…)>)

Execution

                          executes the function operator() (public member function of std::packaged_task<R(Args…)>)                           executes the function ensuring that the result is ready only once the current thread exits make_ready_at_thread_exit (public member function of std::packaged_task<R(Args…)>)                           resets the state abandoning any stored results of previous executions reset (public member function of std::packaged_task<R(Args…)>)