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 to get_memory_resource allocate memory
(public member function)


Non-member function

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

Helper classes


specializes the std::uses_allocator std::uses_allocator<std::experimental::packaged_task> 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 only make_ready_at_thread_exit 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...)>)

2026.11.10 http://cppreference.com