1#ifndef NEFORCE_CORE_ASYNC_EXECUTOR_HPP__
2#define NEFORCE_CORE_ASYNC_EXECUTOR_HPP__
14NEFORCE_BEGIN_NAMESPACE__
60 template <
typename Exec, enable_if_t<!is_same_v<decay_t<Exec>, executor>,
int> = 0>
64 explicit wrapper(Exec e) :
77 exec_->execute(
move(handler));
90 explicit operator bool() const noexcept {
return static_cast<bool>(exec_); }
95 NEFORCE_NODISCARD
bool operator==(
const executor& other)
const noexcept {
return exec_ == other.exec_; }
100 NEFORCE_NODISCARD
bool operator!=(
const executor& other)
const noexcept {
return exec_ != other.exec_; }
111template <
typename Executor>
113 ex.execute(
move(handler));
120NEFORCE_END_NAMESPACE__
executor(Exec exec)
从任意满足 executor 概念的类型构造
bool operator==(const executor &other) const noexcept
相等比较
void post(handler_type handler) const
投递 handler 到执行器
void execute(handler_type handler) const
投递 handler 到执行器
bool operator!=(const executor &other) const noexcept
不等比较
function< void()> handler_type
handler 类型
void post(Executor &ex, function< void()> handler)
向执行器投递 handler
enable_if_t<!is_unbounded_array_v< T > &&is_constructible_v< T, Args... >, shared_ptr< T > > make_shared(Args &&... args)
融合分配创建共享指针
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result) noexcept(noexcept(inner::__move_aux(first, last, result)))
移动范围元素