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


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
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...)>)

2024.06.10 http://cppreference.com