用于获取与对象关联的执行器的 trait 类型。
template< typename T, typename Executor = system_executor> struct associated_executor
|
名称 |
描述 |
|---|---|
|
如果 T 具有嵌套类型 executor_type,则为 T::executor_type。否则为 Executor。 |
|
名称 |
描述 |
|---|---|
|
get [static] |
如果 T 具有嵌套类型 executor_type,则返回 t.get_executor()。否则返回 type()。 |
如果特化中的 T 模板参数是用户定义的类型,程序可以特化此 trait 类型。模板参数 Executor 必须是满足 Executor 要求的类型。
特化应满足以下要求,其中 t 是类型 T 的对象的 const 引用,而 e 是类型 Executor 的对象。
type,它标识一个满足 Executor 要求的类型。get 的 noexcept 静态成员函数,该函数可以被调用为 get(t),其返回类型为 type 或 type 的(可能是 const 的)引用。get 的 noexcept 静态成员函数,该函数可以被调用为 get(t,e),其返回类型为 type 或 type 的(可能是 const 的)引用。
头文件:boost/asio/associated_executor.hpp
便捷头文件: boost/asio.hpp