-
Notifications
You must be signed in to change notification settings - Fork 7
task_builder invoke
Alexy Pellegrini edited this page May 11, 2021
·
2 revisions
nes::task_builder::invoke
template<typename Func, typename... Args>
(1) nes::task_result<std::invoke_result_t<Func, Args...>> invoke(Func&& func, Args&&... args);
- Pushes a task in the thread pool. The return value of the function will be sent through the returned
nes::task_result
. Thenes::task_result
can also be used to know when the task is done. The function may returnsvoid
. The arguments to the function are moved or copied by value, if a reference argument needs to be passed, it has to be wrapped using std::[c]ref, or any other wrapper.
Name | Description |
---|---|
func |
The function to be executed. |
args |
The arguments to be passed to func. |
- Returns a
nes::task_result
that will recieve the return value ofstd::invoke(func, args...);
.
func
must be movable, and std::invoke(func, args...);
must be well-formed.
May throw a std::bad_alloc
.