static_assert(__cpp_noexcept_function_type,"requires c++1z");template<typename T>struct is_noexcept;template<bool IsNoexcept>struct is_noexcept<voID() noexcept(IsNoexcept)> { static constexpr auto value = IsNoexcept;};static_assert(is_noexcept<voID() noexcept>::value);static_assert(!is_noexcept<voID()>::value);int main() {}
与提案P0012有关.
解决方法 > [temp.deduct.type]/8列出了可以推导出模板参数的所有类型的类型.异常规范不在列表中,因此不可推断.>作为 an extension,GCC允许从noexcept中推导出来以简化std :: is_function的实现.看起来扩展只是非常轻微的测试.
>这个扩展最初是由Clang的维护者提出的,似乎在委员会中有一些支持,但是 it’s not clear if it will eventually make its way into the standard.
>这不是一个符合标准的扩展,因为它改变了明确定义的代码的含义,例如g(f)的值与下面的代码片段:
voID f() noexcept;template<bool E = false,class R>constexpr bool g(R (*)() noexcept(E)){ return E;}总结
以上是内存溢出为你收集整理的c – 类模板部分特化中是否允许noexcept演绎?全部内容,希望文章能够帮你解决c – 类模板部分特化中是否允许noexcept演绎?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)