【发布时间】:2020-01-07 11:28:24
【问题描述】:
取自 type_traits 的 GCC 实现,为什么这里需要 static_cast?
template <typename _Tp, typename... _Args>
struct __is_nt_constructible_impl
: public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> {};
template <typename _Tp, typename _Arg>
struct __is_nt_constructible_impl<_Tp, _Arg>
: public integral_constant<bool,
// Why is `static_cast` needed here?
noexcept(static_cast<_Tp>(declval<_Arg>()))> {};
【问题讨论】:
-
这种不一致似乎很奇怪
-
你应该在相关的 libstdc++ 邮件列表中提出这样的问题
标签: c++ typetraits libstdc++ static-cast