Documentation Home >> Headers >> <jss/experimental_future.hpp> Header >> std::experimental::packaged_task >> std::experimental::packaged_task::operator() Function Call Operator

Invoke the task associated with a std::experimental::packaged_task instance, and store the return value or exception in the associated asynchronous result.

void operator()(ArgTypes... args);


*this has an associated task.


Invoke the associated task func as-if INVOKE(func,args...). If the invocation returns normally, store the return value in the asynchronous result associated with *this. If the invocation returns with an exception, store the exception in the asynchronous result associated with *this.


The asynchronous result associated with *this is ready with a stored value or exception. Any threads blocked waiting for the asynchronous result are unblocked.


An exception of type std::future_error with an error code of std::future_errc::promise_already_satisfied if the asynchronous result is already ready..


A successful call to the function call operator happens-before a call to std::experimental::future<ResultType>::get() or std::experimental::shared_future<ResultType>::get() which retrieves the value or exception stored.


#include <experimental/future>

See Also