hpx/futures/packaged_task.hpp#

See Public API for a list of names and headers that are part of the public HPX API.

template<typename Sig, typename Allocator>
struct uses_allocator<hpx::packaged_task<Sig>, Allocator> : public true_type#
namespace hpx

Top level HPX namespace.

template<typename Sig>
class packaged_task#
#include <packaged_task.hpp>

The class template hpx::packaged_task wraps any Callable` target (function, lambda expression, bind expression, or another function object) so that it can be invoked asynchronously. Its return value or exception thrown is stored in a shared state which can be accessed through hpx::future objects. Just like hpx::function, hpx::packaged_task is a polymorphic, allocator-aware container: the stored callable target may be allocated on heap or with a provided allocator.

template<typename R, typename ...Ts>
class packaged_task<R(Ts...)>#

Public Functions

packaged_task() = default#
template<typename F, typename FD = std::decay_t<F>, typename Enable = std::enable_if_t<!std::is_same_v<FD, packaged_task> && is_invocable_r_v<R, FD&, Ts...>>>
inline explicit packaged_task(F &&f)#
template<typename Allocator, typename F, typename FD = std::decay_t<F>, typename Enable = std::enable_if_t<!std::is_same_v<FD, packaged_task> && is_invocable_r_v<R, FD&, Ts...>>>
inline explicit packaged_task(std::allocator_arg_t, Allocator const &a, F &&f)#
packaged_task(packaged_task const &rhs) noexcept = delete#
packaged_task(packaged_task &&rhs) noexcept = default#
packaged_task &operator=(packaged_task const &rhs) noexcept = delete#
packaged_task &operator=(packaged_task &&rhs) noexcept = default#
inline void swap(packaged_task &rhs) noexcept#
inline void operator()(Ts... ts)#
inline hpx::future<R> get_future(error_code &ec = throws)#
inline bool valid() const noexcept#
inline void reset(error_code &ec = throws)#
inline void set_exception(std::exception_ptr const &e)#

Private Types

using function_type = hpx::move_only_function<R(Ts...)>#

Private Members

function_type function_#
hpx::promise<R> promise_#
namespace lcos
namespace local#

Typedefs

typedef hpx::packaged_task<Sig> instead#
namespace std

Functions

template<typename Sig>
void swap(hpx::packaged_task<Sig> &lhs, hpx::packaged_task<Sig> &rhs)#
template<typename Sig, typename Allocator> packaged_task< Sig >, Allocator > : public true_type