13 Asynchronous model [async]

13.17 Function make_work_guard [async.make.work.guard]

template<class Executor> executor_work_guard<Executor> make_work_guard(const Executor& ex);

Returns: executor_work_guard<Executor>(ex).

Remarks: This function shall not participate in overload resolution unless is_executor_v<Executor> is true.

template<class ExecutionContext> executor_work_guard<typename ExecutionContext::executor_type> make_work_guard(ExecutionContext& ctx);

Returns: make_work_guard(ctx.get_executor()).

Remarks: This function shall not participate in overload resolution unless is_convertible<ExecutionContext&, execution_context&>::value is true.

template<class T> executor_work_guard<associated_executor_t<T>> make_work_guard(const T& t);

Returns: make_work_guard(get_associated_executor(t)).

Remarks: This function shall not participate in overload resolution unless is_executor_v<T> is false and is_convertible<T&, execution_context&>::value is false.

template<class T, class U> auto make_work_guard(const T& t, U&& u) -> decltype(make_work_guard(get_associated_executor(t, forward<U>(u))));

Returns: make_work_guard(get_associated_executor(t, forward<U>(u))).