C++(11):true_type, false_type

2023-10-27

true_type和false_type是integral_constant实例化的别名:

C++(11):integral_constant_风静如云的博客-CSDN博客

template <bool _Val>
using bool_constant = integral_constant<bool, _Val>;

using true_type  = bool_constant<true>;
using false_type = bool_constant<false>;

true_type表示通过true实例化的bool_constant的别名类型

false_type表示通过false实例化的bool_constant的别名类型

也就是说true_type和false_type是一种类型,由于是类型,因此可以通过函数的重载的方式解决

C++(11):if constexpr编译期的if_风静如云的博客-CSDN博客

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

C++(11):true_type, false_type 的相关文章