Boost C++ 库

这是世界上评价最高、设计最精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, C++ Coding Standards

associated_executor - Boost C++ 函数库
PrevUpHomeNext

用于获取与对象关联的执行器的 trait 类型。

template<
    typename T,
    typename Executor = system_executor>
struct associated_executor
类型

名称

描述

type

如果 T 具有嵌套类型 executor_type,则为 T::executor_type。否则为 Executor。

成员函数

名称

描述

get [static]

如果 T 具有嵌套类型 executor_type,则返回 t.get_executor()。否则返回 type()。

如果 T 具有嵌套类型 executor_type,则返回 t.get_executor()。否则返回 ex。

如果特化中的 T 模板参数是用户定义的类型,程序可以特化此 trait 类型。模板参数 Executor 必须是满足 Executor 要求的类型。

特化应满足以下要求,其中 t 是类型 T 的对象的 const 引用,而 e 是类型 Executor 的对象。

  • 提供一个嵌套的 typedef type,它标识一个满足 Executor 要求的类型。
  • 提供一个名为 get 的 noexcept 静态成员函数,该函数可以被调用为 get(t),其返回类型为 typetype 的(可能是 const 的)引用。
  • 提供一个名为 get 的 noexcept 静态成员函数,该函数可以被调用为 get(t,e),其返回类型为 typetype 的(可能是 const 的)引用。
要求

头文件:boost/asio/associated_executor.hpp

便捷头文件: boost/asio.hpp


PrevUpHomeNext