licode 源码之pipline 分析
2021/7/27 20:10:46
本文主要是介绍licode 源码之pipline 分析,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
template <class Handler>
struct ContextType {
typedef typename std::conditional<
Handler::dir == HandlerDir::BOTH,
ContextImpl<Handler>,
typename std::conditional<
Handler::dir == HandlerDir::IN,
InboundContextImpl<Handler>,
OutboundContextImpl<Handler>
>::type>::type
type;
};
上面的代码乍一看仿佛很难,但是仔细研究一下也不过如此哈,首先我们要知道 std::conditional 是什么意思,该函数的官方解释为根据判断条件定义type 为何类型,如果判断条件为true,则type定义为第二个参数类型,否则为第三个参数类型。
延伸到ContextType 上来解释就是如果模板Handler的dir是BOTH,则参数类型为 ContextImpl<Handler> ,否则调用 typename std::conditional<
Handler::dir == HandlerDir::IN,
InboundContextImpl<Handler>,
OutboundContextImpl<Handler>
>::type 和上面分析的流程一样,到此 ContextType 的type 就有三种可能,如果dir 为IN 则为 InboundContextImpl<Handler> 如果为OUT 则为OutboundContextImpl<Handler>,如果为BOTH 则为ContextImpl<Handler>
这篇关于licode 源码之pipline 分析的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-07fastcgi 是什么-icode9专业技术文章分享
- 2024-10-07fastcgi 的详细使用教程介绍-icode9专业技术文章分享
- 2024-10-07git如何更新单个文件到本地-icode9专业技术文章分享
- 2024-10-07如何使用ASM(Abstract Syntax Tree Manipulation)技术来修改第三方AAR依赖中的函数-icode9专业技术文章分享
- 2024-10-07Activity 跳转时间耗时很长怎么优化解决-icode9专业技术文章分享
- 2024-10-07Androud Toast 有哪些常用的第三方组件-icode9专业技术文章分享
- 2024-10-07在viewmodel中怎么使用 mmkv?-icode9专业技术文章分享
- 2024-10-07MMKV.defaultMMKV() 是单例模式吗?-icode9专业技术文章分享
- 2024-10-04el-table 开启定时器下,表格的选中状态会消失是什么原因-icode9专业技术文章分享
- 2024-10-03如何安装和初始化飞牛私有云 fnOS?-icode9专业技术文章分享