"typename Enable = void"是什么意思? [英] What does 'typename Enable = void' mean?

查看:92
本文介绍了"typename Enable = void"是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 typename Enable = void 但是,我找不到在Enable .h"rel =" noreferrer>头文件,这让我感到困惑. typename Enable = void 在模板中是什么意思?

However, I cannot find the Enable is used in this header file, which confuse me. What does typename Enable = void mean in template?

推荐答案

它允许SFINAE具有模板专业化功能,例如

It is to allow SFINAE with template specialization, as something like

template<typename T>
struct RefTypeTraits<T, std::enable_if_t<some_condition<T>::value>> {
    // ... specialization for T which respects condition
};

这篇关于"typename Enable = void"是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆