Scroll to navigation

std::experimental::packaged_task(libraryfundamentalsTS)(3) C++ Standard Libary std::experimental::packaged_task(libraryfundamentalsTS)(3)

NAME

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


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


Non-member function


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

Helper classes


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

Members identical to std::packaged_task

Member functions


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

Getting the result


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

Execution


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

2022.07.31 http://cppreference.com